Text, Filters, and Now Vectors in One Postgres Index


The explosion in pgvector use has shown how valuable vectors are alongside the relational data they represent. But once you move past toy examples and benchmarks, most heavy users of Postgres vector indexes will struggle to scale in production because:
- Filtering: Complex
WHEREclauses can slow queries dramatically or reduce recall. - Memory: Large datasets demand more memory to build and search.
- Continuous updates: Heavy writes add maintenance work to preserve recall and performance.
Today we're announcing native vector support in ParadeDB. Following in the footsteps of search engines, vectors live in the same index that powers text search, addressing filtering and memory together. Support for continuous updates is still in development.
Rather than compare against just Postgres vector extensions, we decided to raise the bar and benchmark against a dedicated search engine. Here's how we compare with Turbopuffer on vector search over the 28 million-row Hacker News dataset1, with a 0.01% selectivity text filter:
Warm runs · one concurrent client · measured recall shown. Explore the full comparison below.
In the following sections, we'll first share some more performance results. Then, we'll do a deep dive into our architecture and roadmap.
Why We Benchmarked Against Turbopuffer
To keep search in Postgres, we need to be competitive with dedicated search engines. Being faster than another Postgres vector index matters less if an external vector database performs significantly better. We benchmark against Turbopuffer, which we consider to be one of the most popular vector databases, to test that.
ParadeDB excels at both unfiltered and filtered vector search. For unfiltered search we use the 113 million MS Marco dataset. Here ParadeDB delivers 1.7× Turbopuffer's throughput for top-10 search, at 95.2% versus 94% measured recall2.
Before we continue, we'd like to note that an apples-to-apples comparison was not fully possible for a few reasons:
- Different Recalls: ParadeDB exposes a query-time knob to tune recall3, but Turbopuffer does not. Queries are faster at lower recall, so comparisons of different vector engines should be done at equal recall. For most of these comparisons, the recalls of ParadeDB and Turbopuffer differ slightly and are shown in the graphs.
- Different Hardware: Postgres benchmarks were run on AWS EC2
c8gd.metal-24xlinstances with local NVMe SSD storage, with each database running in a Docker container limited to 8 CPUs and 32 GiB of RAM4. Aside from its use of NVMe SSDs for caching, Turbopuffer's exact hardware configuration and the CPU and memory resources allocated are unknown to us. - Network Latency: Because Turbopuffer runs on their cloud (we do not have access to their BYOC), they are disadvantaged in our benchmarks by sub-1ms network latency.
For these reasons we are not claiming to be faster than Turbopuffer, even if it appears that way in the results. Instead, we are including Turbopuffer to demonstrate that you can expect comparable vector search performance between the two databases, running ParadeDB on a modest 8 CPUs and 32GB RAM. This is not the case for any other Postgres vector extension. As you will see below, in some filtered cases they are hundreds of times slower and miss ranges of recall targets.
Our results are reproducible with benchmarker and we welcome verification.
What Happens When We Add Filters?
On the 28M Hacker News dataset, we tested top-10 searches with date range and text filters. For instance, a ParadeDB vector search with a date range filter looks like:
SELECT id FROM hn_items
WHERE id @@@ pdb.all()
AND time >= '2021-09-09T06:23:25+00:00'::timestamptz
ORDER BY emb <=> '[...]'::vector(1536)
LIMIT 10;
A text filter looks like:
SELECT id FROM hn_items
WHERE id @@@ pdb.all()
AND "by" = 'rossdavidh'
ORDER BY emb <=> '[...]'::vector(1536)
LIMIT 10;
In our benchmarks, ParadeDB is competitive with Turbopuffer at lower selectivities and races ahead at higher selectivities. For instance, with text filters matching 0.01% and 0.001% of the dataset, ParadeDB delivers 3.9× and 5.6× Turbopuffer's throughput, respectively, at 100% measured recall.
How We Built It: A Filter-Aware Index
The ParadeDB index was already filter-aware for text search and facets.
The tricky part about extending that ability to vectors is that more selective filters require deeper, more expensive probing into the vector index where large amounts of work could get thrown away. With pgvector and every other vector extension, filters are applied after vector candidates are found. This means that, under a 1% selectivity filter, only 1 out of 100 vectors read and scored could actually make it into the result set. The rest is wasted work.
ParadeDB avoids that wasted work because vectors and filterable fields share an index. For the Hacker News queries above, vectors are indexed alongside the fields that support text search and range filtering:
CREATE INDEX hn_search_idx ON hn_items
USING paradedb (
id,
title,
("by"::pdb.literal),
time,
emb vector_cosine_ops
);
Before doing any vector-related work, ParadeDB first evaluates the filter(s) into a bitset of matching document identifiers. During vector search, the index checks each candidate's identifier against the bitset before it loads or scores the vector. Candidates that fail the filter incur only a fast bitset check instead of an expensive vector calculation.
To see just how efficient ParadeDB is at evaluating filters, the following graph compares throughput over the Cohere 10M dataset at three different selectivities: 1%, 10%, and unfiltered. Notice how, for a given recall target, the filtered queries are similarly as fast as the unfiltered queries.
This is not the case with any other Postgres extension because of a fundamental architectural difference: they require separate indexes for vectors and other fields. We discussed in a previous blog post how performance-critical it is for filters to be indexed alongside text. The same is true for vectors.
Here is the same filtered-versus-unfiltered comparison for vectorchord and pg_vectorsearch. At the 95% recall target, applying a 1% filter reduces vectorchord's throughput by 70× and pg_vectorsearch's by an estimated 92×.
How We Compare with Other Postgres Vector Extensions
We chose pg_vectorsearch and vectorchord as our Postgres baselines because both have pushed vector search performance beyond pgvector. Here's how they compare with ParadeDB on the filtered Hacker News query from the introduction56:
Warm runs · one concurrent client · measured recall shown. The comparison targets 99% recall. Below-target bars show estimated QPS from average query time, with the measured recall flagged. Explore the full comparison below.
Additionally, we tested six filters matching from 10% down to 0.001% of rows at three recall targets. Only ParadeDB reached all 18 recall targets. vectorchord reached 16, while pg_vectorsearch reached three.
Generally speaking, the more selective the filters become, the worse the other Postgres extensions perform. For example, pg_vectorsearch's highest achieved recall on the 0.001% text filter was 16.4%, at near-zero estimated throughput.
Unfiltered vector search is a closer contest, and is where the existing Postgres vector extensions do well. On the MS MARCO 113 million dataset4:
- ParadeDB delivers 2.0×–9.5× the throughput of
vectorchordacross the board. - ParadeDB outperforms
pg_vectorsearchin four of the five comparisons where both reached the recall target.pg_vectorsearchleads for top 10 at 90% recall. It missed the top-10 99% recall target.
To the best of our knowledge, every other Postgres platform uses one of
pgvector, vectorchord, pg_vectorsearch, or a rebranded fork for vector
search.
Constraining Memory During Index Build
Vector indexes that require memory usage to increase linearly with dataset size fundamentally do not scale.
For us, the main challenge with constraining memory during index build was making our k-means algorithm bounded in memory. For context, the ParadeDB vector index is a cluster-based index, and k-means is the standard algorithm for generating clusters. If not handled carefully, k-means increases memory consumption with dataset size, since larger datasets produce more clusters which require more data points to be sampled.
ParadeDB circumvents this by implementing a streaming k-means algorithm. The idea is that instead of holding the entire training set in memory, we read vectors in batches and do k-means iteration over each batch. We have open-sourced our k-means implementation. It's a Rust port of SuperKMeans, a C++ library developed by researchers at CWI, with additional features like streaming k-means, cluster balancing, and boundary replication of vectors across clusters.
To demonstrate our memory efficiency, all benchmarks in this post were run on a Docker container with 32GB memory, only 8GB of which was allocated to index build (via maintenance_work_mem). This memory allocation is a tiny fraction of the total dataset and index size. MSMarco's embeddings alone contain approximately 430GB of float values.
Under the 8GB memory constraint, only the ParadeDB index built the MSMarco dataset successfully at its default settings. Both pg_vectorsearch and vectorchord ran out of memory, crashed, and required adjustments. Because vectorchord holds the training set in memory, it requires the k-means sampling rate to be manually dialed down (which degrades the quality of the resulting index). pg_vectorsearch had a memory leak that we fixed.
We also optimized our index build time to be very fast. Here's how long it took to index the 113M MSMarco vectors:
32 GiB RAM per Postgres database, with 8 GiB maintenance_work_mem. Postgres timings cover CREATE INDEX, excluding data loading. Turbopuffer includes the full time to load and index the data, which includes network transmission. This time is still representative of the time taken if an external index was connected to Postgres.
Constraining Memory During Search
One of the reasons we picked a cluster-based vector index over a graph-based index like HNSW is because the access patterns of cluster-based indexes are much more friendly when the index is too big to fit in memory.
Because HNSW follows vector connections scattered throughout a graph, each hop can turn into a random disk read on uncached data. This is why pgvector, which uses HNSW, forces many users to raise their instance's memory to the size of the index. It's also why we are skeptical of any HNSW-based vector index's ability to scale.
Cluster-based indexes, on the other hand, store each cluster's vectors contiguously, so searching a cluster translates into sequential reads.
Our index is specifically designed to incur as few disk reads as possible. In our benchmarks, we ensure that most of the index cannot simply be cached in memory for search by sizing the Postgres shared_buffers pool to 8GB.
A Deeper Look at Our Cluster-Based Architecture
Our architecture draws on the SPANN and Quake papers:
Find the most promising clusters
The starting idea is simple: group similar vectors into clusters, and give each cluster a representative vector called a centroid. A query first finds the nearest centroids, then compares itself against the vectors in just those clusters instead of the entire dataset.
ParadeDB extends this idea into a hierarchy: clusters can be created over clusters. This idea, borrowed from Quake, allows the centroid list to scale. As the dataset grows, another level in the hierarchy keeps each layer small.
Search starts at the top of the hierarchy and works its way down. Once the bottom is reached, the most promising clusters are visited.
Scan clusters to eliminate noncompetitive vectors
Each cluster stores quantized vectors. Quantization compresses vectors, allowing noncompetitive vectors to be cheaply eliminated without paying the cost of full precision scoring.
ParadeDB uses a two-layer quantization strategy, where the first layer 1-bit quantizes the vector's residual from its cluster centroid, and the second layer 1-bit quantizes the error left by the first layer. Quantized vectors are also boundary replicated, meaning that a vector sitting close to two clusters is replicated across both. This technique, borrowed from SPANN, helps with recall.
Filters are also applied here. If a vector's identifier fails the filter, we skip its quantized vector.
Score the survivors at full precision
Finally, candidates that survive both layers of the quantized scan are ranked by their full precision vectors to produce the final result set. The idea is that each previous pruning step (cluster scan, then two quantized layers) constricts the search space further.
By the time this step is reached, the full precision candidate set is very small (in our 113M MSMarco dataset, only a few hundred candidates survive to this point).
Like the rest of ParadeDB, our vector search implementation is entirely open source:
- ParadeDB: The Postgres extension and SQL integration.
- Our Tantivy fork: Vector indexing, routing, and search. We will upstream as much of this as possible in the coming months.
- SuperKMeans: Rust port of SuperKMeans for building clusters.
Continuous Updates are Next
Our next target is support for continuous updates (i.e. preventing frequent updates from affecting recall/performance). We are solving this by allowing clusters to cheaply update themselves as new data arrives. Our approach will lean on both SPFresh for cluster rebalancing and segment partitioning to create an optimal distribution of vectors across our segment-based layout.
This means that for now, our vector search is tested and ready for mostly static datasets (i.e. an index that can be created after all the data has been loaded, and new data infrequently arrives). If your vector search workload requires frequently updated data, contact us. We'd love to work closely with you as we build it.
This is specifically for ParadeDB indexes containing vectors. For all other fields, we ensure high read performance under continuous writes.
Wrapping Up
ParadeDB already delivers excellent filtered text search to Postgres, eliminating the need for a separate search engine like Elasticsearch. Now we're doing the same for vectors.
Our vector search has already been in beta for two months. The features in this post are available on ParadeDB 0.27.0 and later. We invite you to run it over your data locally or on ParadeDB Cloud.
Footnotes
-
The MSMarco dataset does not contain filterable fields, so we use Hacker News for the filtered search benchmarks. Turbopuffer requires a vector on load, so we loaded the 24.1 million Hacker News rows with embeddings out of 28.7 million total. Because no vectors were dropped, no results will change. ↩
-
Recall@k measures how many of the actual top-k nearest neighbors a search returns. Turbopuffer automatically tunes its vector index to stay within a recall range. The graphs show the measured recall for each Turbopuffer query alongside ParadeDB runs with higher and lower recall. This shows the tradeoff between accuracy and throughput.
These are warm runs. Turbopuffer uses object storage such as S3, which lets it scale storage and compute independently. It caches data on NVMe SSD and in memory. The benchmark waited for indexing to finish and then sent a cache-warming hint. It ran queries until performance stabilized, which sometimes took several iterations. Turbopuffer runs on separate cloud hardware in a setup closer to a serverless database. Its measurements include network latency. The results compare the deployments we tested. ↩
-
Recall measures how many of the actual nearest neighbors a search finds. For example, finding nine out of the ten actual nearest neighbors would result in a 90% recall value. ↩
-
The MS MARCO VectorChord search results come from a 64-CPU run with no Docker CPU limit. The first 8-CPU run stopped during the recall sweep. We'll replace these results once the 8-CPU rerun completes successfully. We do not expect this to make much difference as the runs do not saturate CPU. 64-CPU run · First 8-CPU run · 8-CPU rerun ↩ ↩2
-
For filtered queries,
vectorchordsupports two modes: prefiltering on or off. We benchmarked both and automatically selected the faster result that reached each recall target. If neither mode reached the target, we show the result with the highest measured recall. ↩ -
When a recall target was missed we estimate QPS using the average query time at the highest measured recall. ↩