ruvector
ruvector-postgres · SIMD-accelerated vector type and indexes with graph, solver, TDA, local embedding, and AI SQL functions.
Overview
| ID | Extension | Package | Version | Category | License | Language |
|---|---|---|---|---|---|---|
| 101155 | ruvector | ruvector-postgres | 0.3.0 | RAG | MIT | Rust |
PostgreSQL · 14, 15, 16, 17
Usage
Sources:
ruvector adds a fixed-dimension vector type, distance operators, and a RuVector HNSW access method to PostgreSQL. Use it for nearest-neighbor retrieval after confirming that the exact packaged build exposes the functions you need: the reviewed extension control version is 0.3.0, while the current Rust crate manifest reports 2.0.1 and gates many advanced modules behind compile-time features.
Core Workflow
Create the extension, store vectors with an explicit dimension, and order by the chosen distance operator:
The query must contain the same ORDER BY distance expression used to rank rows. Validate recall, latency, and index behavior with representative data rather than treating an approximate-nearest-neighbor result as exact.
Important Objects
ruvector(n)stores vectors whose dimension is fixed by the type modifier.<->computes L2 distance for ordering; the upstream extension also defines function forms for L2, cosine, inner-product, and Manhattan calculations.ruhnswis the HNSW index access method, andruvector_l2_opsselects its L2 operator class.- Advanced graph, attention, solver, local-embedding, and mathematical functions are feature-dependent. Inspect
pg_procon the installed build before relying on a function shown by newer upstream documentation.
Operational Notes
The reviewed upstream README declares PostgreSQL 14 through 17 support; test the package against the exact server major version. The control file marks the extension trusted and non-relocatable, but object privileges still need normal review.
HNSW indexes trade build time, memory, disk space, and exactness for search speed. Rebuild and recall-test them after major upgrades or bulk data changes, and include both the table and index in backup/restore exercises. Local embedding or AI functions, when compiled in, load models and run inference inside database backends, so measure backend memory, CPU use, statement timeouts, and concurrency before enabling them for production traffic.