pg_cuvs
pg_cuvs · NVIDIA cuVS GPU search and GPU-assisted pgvector HNSW builds.
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 101530 | pg_cuvs | pg_cuvs | 0.9.4 | RAG | PostgreSQL | C |
PostgreSQL · 16
| Relationships | |
|---|---|
| Requires | vector |
Usage
Sources:
pg_cuvs 0.9.4 integrates NVIDIA cuVS GPU vector search and GPU-assisted pgvector HNSW construction. The documented runtime is Linux/PostgreSQL16 with a matching GPU daemon, CUDA/cuVS stack and vector extension. Validate device memory and recall for the actual workload.
Enable and Query
Install matching module and daemon binaries, append pg_cuvs to the preload list and restart PostgreSQL. Create the extensions, then build an index on an existing vector column:
The cagra and ivfpq methods are approximate; flat is exhaustive GPU search. pg_cuvs_hnsw builds on GPU and serves pgvector HNSW pages on CPU. cuvs.k controls candidate count separately from SQL LIMIT. pg_stat_gpu_search and index-identity helpers support diagnosis; an EXPLAIN plan proves the route selected, not recall.
Storage and Write Boundaries
New single-GPU CAGRA indexes now default to PostgreSQL page storage and WAL. Existing legacy indexes keep their original sidecars until rebuilt. A legacy-only CUVS_PAGE_FORMAT=0 build can create sharded indexes but cannot open page-format indexes; merely downgrading binaries does not convert storage.
Sharded CAGRA and IVF-PQ reject INSERT, COPY and updates that add index entries with SQLSTATE0A000. Load the data first or rebuild as a supported single-GPU CAGRA index for continued writes. Legacy sidecars and journals need separate backup/recovery; do not extend page-format WAL guarantees to them. Review the release’s custom index-directory and old compaction caveats before trusting an existing legacy graph.
Upgrade, Privileges and Errors
Install both matching binaries and restart PostgreSQL and the daemon before applying the SQL upgrade. Plan storage downgrades before creating page-format indexes, and retain a page-capable binary for recovery. The release includes row-level-security enforcement for batch/filtered search, filters statistics by privileges and requires index ownership or superuser privilege for circuit reset.
Daemon failure after planning raises an error rather than silently changing an executing statement to CPU. Roll back and inspect the retry plan. enable_cuvs=off disables GPU planning. GPU allocation and SDK/device behavior remain environment-specific; successful tests on one GPU do not establish universal compatibility.