Skip to content

Configuring pg_vectorize

Changing the database

To change the database that pg_vectorize background worker is connected to, you can use the following SQL command:

ALTER SYSTEM SET vectorize.database_name TO 'my_new_db';

Then, restart Postgres.

Changing Embedding and LLM base URLs

All Embedding model and LLM providers can have their base URLs changed.

For example, if you have an OpenAI compliant embedding or LLM server (such as vLLM), running at https://api.myserver.com/v1, you can change the base URL with the following SQL command:

ALTER SYSTEM SET vectorize.openai_service_url TO 'https://api.myserver.com/v1';
SELECT pg_reload_conf();

Changing the batch job size

Text data stored in Postgres is transformed into embeddings via HTTP requests made from the pg_vectorize background worker. Requests are made to the specified embedding service in batch (multiple inputs per request). The number of inputs per request is determined by the vectorize.batch_size GUC. This has no impact on transformations that occur during vectorize.search(), vectorize.encode() and vectorize.rag() which are always batch size 1 since those APIs accept only a single input (the raw text query).

ALTER SYSTEM SET vectorize.batch_size to 100;

Available GUCs

The complete list of GUCs available for pg_vectorize are defined in extension/src/guc.rs.