Web Dev//SQL//PostgreSQL//pgvector

Extension for PostgreSQL that adds vector columns, storage, and similarity search directly inside the database. Turns Postgres into a lightweight vector database.


Extension for PostgreSQL that adds vector columns, storage, and similarity search directly inside the database. Turns Postgres into a lightweight vector database.

Adds a VECTOR(n) column type — stores embeddings alongside normal relational data in the same table

Supports cosine similarity, Euclidean distance, and inner product — calculated inside SQL queries

The killer feature: SELECT * FROM docs WHERE category='X' ORDER BY embedding <-> query_vector LIMIT 5 — relational filtering AND vector search in one query. No syncing IDs between two systems.

Uses HNSW indexes for approximate nearest neighbor search

The tradeoff vs Pinecone/Weaviate: pgvector is slower at pure vector search scale (millions of embeddings), but you get everything in one database