Skip to main content
This is a beta feature available in versions 0.25.0 and above. See How Vector Search Works for background.
Make sure the pgvector extension is installed first. ParadeDB uses pgvector’s vector types, but not its HNSW or IVF indexes.
The ParadeDB index can index pgvector’s vector type alongside your text and other columns. This lets you combine vector search with full text search and filters in a single index, which can significantly improve latency/recall for selective queries.

Creating the Index

The mock_items table comes with an embedding column of type vector(8) populated with sample embeddings. In this example, embedding is added to the ParadeDB index with cosine similarity as the distance function.
The desired distance function is encoded into the index definition, and cannot be changed without reindexing.
Only pgvector’s vector type is supported. The halfvec, sparsevec, and bit types are not yet indexable.
If you track index build progress with pg_stat_progress_create_index, you may notice progress appear to “stop” at intervals. This is expected: vectors are clustered with k-means at these points, which is computationally expensive.

Index Options

ParadeDB uses a SPANN-style vector index, which is similar to an IVF index but with additional structures to improve recall and latency, especially over large datasets. The following WITH options control how vectors are clustered and indexed. All are set at index build time and apply to every vector field in the index. An example:
default:0.32
The fraction of indexed vectors sampled to train the clustering at build time. Must be between 0.000001 and 1.0; 1.0 trains on every vector. The default samples 32% of the vectors. Larger samples can improve centroid quality at the cost of a slower, more memory-intensive build.
default:200
The maximum number of sampled training vectors in a leaf of the hierarchical clustering tree. Must be an integer between 1 and 2147483647. Smaller values generally produce more centroids and smaller clusters; the actual centroid count depends on the clustering result. This setting is independent of training_sample_ratio and does not cap the number of indexed vectors assigned to a cluster.
These options replace centroid_ratio and training_samples_per_centroid. The old names are no longer accepted. Recreate indexes that explicitly store either old option using the new options; REINDEX alone does not remove obsolete index options. The new defaults sample 32% of vectors and use a maximum training leaf size of 100.