pgvector engine. You can switch it to native, which runs the search engine Pinecone uses at scale inside Postgres. Your queries and data stay the same, and you can switch back to pgvector at any time.
Before you begin
- pg_pinecone installed and created in the database, as steps 1 and 2 of the quickstart show.
- A table with a
vectorcolumn and a pgvector index on that column created withCREATE INDEX. Ifpinecone.create_index()built the pgvector index instead, skip this guide and switch it with one call:SELECT pinecone.set_engine('your_table', 'native');. - A single-column primary key, if you plan to switch to
remotelater. Anativeindex doesn’t need one.
Replace the index
Create a native index
Create a
native index on the table’s vector column. The pgvector index keeps serving queries while the native index builds:SQL
pinecone.create_index() uses cosine distance by default. If your pgvector index uses a different distance, pass the matching metric: 'l2' for vector_l2_ops, or 'ip' for vector_ip_ops.If your queries filter on one column, such as a tenant ID, add it as a filter column with filter_column => 'tenant_id'. See Filter column.Check which index serves queries
Run The plan includes
EXPLAIN on a similarity query. This one uses a row’s own vector as the query:SQL
Index Scan using your_table_embedding_pinecone_idx. pinecone.create_index() names the index <table>_<column>_pinecone_idx. On a small table, Postgres may choose to read every row instead of using any index, because that’s cheaper.Switch back to pgvector
If the table uses theremote engine, switch it back to native first.