Vector data in Postgres: Size, TOAST, Filters and Performance
summary
Vectors store as arrays of single-precision floats (float4 storage) and common embeddings run 500–1,500 dimensions; anything over ~2 KB goes to Postgres TOAST -> chunks -> 4 IOs per vector so a 1M-row brute-force scan can add ~4M extra IOs and inline brute force examples hit ~1s per million. Use ANN indexes: IVF (e.g. 100 lists, probe 3 lists) trades recall for speed; HNSW gives better recall but far higher build and DML cost; index dimension limit is 2,000 unless you quantize or cast.
AI-written summary · about
chapters (18)
- 0:00Introduction
- 1:28What are vectors
- 6:34Vector storage in Postgres
- 9:24Why store vectors
- 9:47Brute force KNN search
- 14:06Approximate nearest neighbor
- 16:15Vector size limits for indexes
- 17:43Vector indexes overview
- 19:09IVF flat index
- 22:02HNSW index
- 23:48SCAN index
- 25:32Index build time comparison
- 27:02Improving index build performance
- 28:10Reducing search area
- 29:15Filtering strategies
- 33:13DML operations impact
- 38:10Recommendations for vector data
- 42:10Q&A session
related talks
48mVectors are the new JSON
25mVector data in Postgres - how's it different from "normal" data?
53mVectors: how to better support a nasty data type in PostgreSQL
52mVector search is now boring, but PostgreSQL has ways to go
41mPostgreSQL for AI. Real Vector Search in PostgreSQL
52mpgvector Newbie to Expert
44mScaling Semantic Search in PostgreSQL
48mFrom Text to Meaning: pgvector Transforms PostgreSQL Search
