The case against pgvector

AI-generated summary of reporting by Simon Willison’s Weblog. Read the original for the full story.

Why it matters

Teams betting on pgvector for large-scale vector search learn the hard-won pitfalls, index maintenance, insert throughput and pre- vs post-filtering, before they hit them themselves.

Read this as

Alex Jacobs wrote a detailed guide on the problems of running pgvector, a database add-on that lets the PostgreSQL database store and search AI embeddings (numeric fingerprints of text used for similarity search). He explains that keeping huge indexes up to date with fast-changing data is hard, and that filtering queries by document status before or after the vector search can make a query take 50ms or 5 seconds. A Hacker News discussion adds how Discourse runs pgvector at scale.

If your company is embedding vector search inside PostgreSQL using pgvector, this article documents the operational risks before you commit: IVFFlat and HNSW indexes become expensive to maintain with frequent updates, and naive filtering can turn a 50ms query into a 5-second one with wrong results. Counterpoint: Discourse reports running pgvector across thousands of databases, serving billions of page views, using quantization to make it viable everywhere.

Jacobs details maintaining large pgvector indexes with near-realtime updates using IVFFlat or HNSW index types. The key section covers pre- vs post-filtering: filtering on document status before the vector search versus after changes both latency and result relevance by orders of magnitude. In the Hacker News thread, Rafael dos Santos Silva (xfalcox) describes Discourse's production setup: halfvec (16-bit float) for storage and bit (binary vectors) for indexes, quantization that made enabling it across all hosting viable.

Read the original

This summary exists to save you time, not to replace the source.

Key terms

pgvector PostgreSQL Discourse IVFFlat HNSW halfvec

Was this summary useful?

One click, anonymous. It tells us which summaries to re-run.

Related reading