Vector data in Postgres - how's it different from "normal" data?
summary
Postgres stores vectors as arrays of 32-bit floats (OpenAI models use 1536 dims → ~6 KB per vector), so indexes must fit in RAM and HNSW index build runs in-memory under maintenance_work_mem. pgvector exposes pgvector datatypes and implements HNSW and IVF‑Flat; graph indexes are CPU‑ and memory‑heavy, approximate (ORDER BY distance can return wrong ordering and filtered queries can drop hits). New types like halfvec and sparsevec shrink storage — example build time drops from ~6m42s to ~5m14s and table size roughly halves.
AI-written summary · about
chapters (9)
- 0:00Intro
- 1:37Vector search is expensive
- 2:30What is a vector?
- 3:57Vectors are large
- 6:36What is vector search?
- 11:45Vector search is approximate
- 15:17Types of vector search algorithms
- 20:12Three new datatypes in pgvector 0.7.0
- 23:55Summary
related talks
48mVectors are the new JSON
53mVectors: how to better support a nasty data type in PostgreSQL
51mVector data in Postgres: Size, TOAST, Filters and Performance
52mVector search is now boring, but PostgreSQL has ways to go
52mpgvector Newbie to Expert
41mPostgreSQL for AI. Real Vector Search in PostgreSQL
44mScaling Semantic Search in PostgreSQL
48mFrom Text to Meaning: pgvector Transforms PostgreSQL Search
