remote engine. Pinecone stores a copy of the vectors and answers the table’s similarity queries, and Postgres keeps every row. Your queries don’t change, and you can switch back to native at any time.
Before you begin
- pg_pinecone installed, as the quickstart shows.
- A Pinecone API key stored in the database, which the
remoteengine needs even if you bring your own vectors. Store it withSELECT pinecone.set_api_key('YOUR_API_KEY');. - A table with a
nativeindex. The examples use thedocstable from the quickstart, so skip the quickstart’s clean-up step if you want to follow along.
Switch to the remote engine
Theremote engine relies on a background worker that copies writes to Pinecone, and Postgres starts that worker only when the extension is preloaded.
Preload the extension
Add Then restart Postgres. For example,
pg_pinecone to shared_preload_libraries in postgresql.conf. To find the file, run SHOW config_file; in psql. If the setting already lists other libraries, add pg_pinecone to the list:postgresql.conf
sudo systemctl restart postgresql on most Linux installs, or brew services restart postgresql@17 with Homebrew on macOS.Switch the engine
Reconnect and switch the table to the This creates a serverless index in your Pinecone project and starts copying the table’s vectors to it in the background. The index is created in
remote engine:SQL
aws us-east-1 unless you set pinecone.am_cloud and pinecone.am_region first. While the copy runs, queries keep using the native index, so reads and writes aren’t interrupted.Wait for the copy to finish
Check progress with
pinecone.status():SQL
mode is promoting while the copy runs. When mode is remote and backlog is 0, Pinecone is serving the table’s queries. In version 0.10.0 and later, a table of a million rows takes up to about an hour to copy at the default settings.Run the same query
Run the quickstart’s query again, unchanged:Pinecone now serves the results. The new index also appears in the Pinecone console under the name
- Your own vectors
- Pinecone embeddings
SQL
pinecone.status() reports.Switch back to native
Switching back moves the table’s search into Postgres again. Postgres still has every row, so nothing is copied back from Pinecone. The rebuild blocks queries and writes on the table while it runs, as Switching engines explains, so plan it for a quiet period.Switch the engine back
SQL
native index from the table, then deletes the Pinecone index it created.Query the index from your application
The Pinecone index that theremote engine creates is a standard Pinecone Database index, so your application can also query it directly with a Pinecone SDK. The table’s records are in a namespace named after the table, such as public.docs, so pass that namespace in your query. Its record IDs are Postgres row locations in block:offset form, not your primary key values, so look up matching rows through Postgres. To move a workload off Postgres entirely, see Migrate from pgvector.