pgvector
pgvector adds vector similarity search to PostgreSQL. With it, Bifrost keeps its vectors in a PostgreSQL database, so a deployment that already runs PostgreSQL needs no separate vector database.Key Features
- Runs on PostgreSQL: the same database as the config or logs store, or a separate one
- HNSW indexes: approximate nearest-neighbour search, with filters on stored properties
- Shared across replicas: every Bifrost replica reads and writes the same tables
- Own connection pool: pgvector connects with its own settings and pool, like the other vector stores
Requirements
- PostgreSQL with the pgvector extension, version 0.8.0 or later. 0.8.0 is the first release with iterative index scans, which a filtered search needs to return a full set of results.
- At startup Bifrost runs
CREATE EXTENSION IF NOT EXISTS vectorwhen its database user is allowed to. If it is not, Bifrost refuses to start and prints the command a database administrator has to run. - Bifrost does not upgrade an installed extension. An older version makes it refuse to start with the
ALTER EXTENSION vector UPDATE;command to run. - The extension’s schema must be on the database user’s
search_path. If it is not, the startup error names the schema and gives anALTER ROLE ... SET search_pathcommand that keeps the current entries.
Setup & Installation
Local PostgreSQL:default_version must be 0.8.0 or later; if it is not, upgrade the engine’s minor version. If Bifrost’s user may not create extensions, have an administrator run CREATE EXTENSION vector; in the database first.
Configuration Options
- Go SDK
- config.json
store.Close(ctx, "") closes it.Configuration Reference
Theconfig block takes the same connection settings as a PostgreSQL config or logs store, without the logs store’s materialized-view and migration settings.
How Vectors Are Stored
- One table per namespace. pgvector indexes only fixed-dimension columns, so each namespace gets its own table, named from a hash of the namespace and its dimension. The
vector_store_namespacestable maps namespaces to their tables. - Indexing by dimension. Up to 2,000 dimensions a namespace gets an HNSW index on the
vectorcolumn. From 2,001 to 4,000 it gets an HNSW index over ahalfvecexpression, and results are re-ranked at full precision. Above 4,000, up to the 16,000 maximum, searches are exact. - Properties are one
jsonbcolumn with a GIN index, which serves equality and contains filters. Integer properties declared when the namespace is created also get a btree index, which serves range filters. - Entries without a vector are allowed, so caches that store metadata-only entries work as they do on Redis.
Production Considerations
- Connections. pgvector opens its own pool, in addition to the config and logs stores’ pools. A pod’s connection ceiling is the sum of their
max_open_conns, which matters on a small managed instance. - Shared load. On the same database as the logs store, vector searches and writes share its CPU, memory, and I/O with request logging.
- Multiple replicas. Replicas coordinate namespace creation and deletion through PostgreSQL advisory locks, so they can start together against an empty database.
- Session settings. pgvector sets the settings each search needs, such as
hnsw.iterative_scan, on the transaction, and pinsREAD COMMITTEDwhere it depends on it, so it does not rely on the database user’s defaults.
For Kubernetes deployments, see Helm storage. The chart’s bundled PostgreSQL image does not include pgvector by default.

