Installation
Firstly, you will need to install specific dependencies necessary for working with Postgres and PGVector:Setup
You will need a running Postgres database instance, and the existing handler works with both local and cloud setups. All you need to do is provide the necessary connection information, like the following example does for a local setup:docker-compose.yml file, or your own:
Usage
The PGVector handler is registered in Cognee by default, so all that is left to do is to let Cognee know which handler you are using. This can be done by setting the following.env variable:
Connection pool tuning
In multi-user mode each dataset gets its own PGVector engine, so the total number of open connections grows with the number of active datasets (number of datasets × pool size). To keep this fan-out in check, per-dataset PGVector engines use a small connection pool by default (pool_size=2, max_overflow=20) instead of inheriting the larger relational pool.
You can override these defaults with the VECTOR_POOL_ARGS environment variable, which takes a
JSON object whose keys are passed through to SQLAlchemy’s create_async_engine:
VECTOR_POOL_ARGS applies only to PGVector per-dataset engines and is independent from
the relational POOL_ARGS. The value must be a JSON object; invalid JSON raises a configuration
error (VECTOR_POOL_ARGS must be valid JSON) at startup. Restart your process or container after
changing it so the new pool settings take effect.
SSL / connect args for managed Postgres
When a per-dataset PGVector engine connects to managed Postgres that enforces SSL (for example Neon), it now inherits the relationalDATABASE_CONNECT_ARGS connection arguments, so asyncpg SSL options
supplied there are honored for these engines too. Leaving DATABASE_CONNECT_ARGS unset is a no-op.
See Relational Databases → Managed Postgres with SSL
for the DATABASE_CONNECT_ARGS format.
Vector Stores
Details About Cognee’s Vector Stores
Multi-User Overview
More Details About Multi-User Mode