PostgreSQL Architecture Overview: PostgreSQL uses a process-per-connection model with shared memory pools, background writer processes, and the WAL (Write-Ahead Log) system. Extensions like pgvector integrate directly into this architecture, storing vector data in regular PostgreSQL tables with specialized indexing.
pgvector is a PostgreSQL extension that lets you store and search vector embeddings without migrating to some expensive vector database service. Andrew Kane started it around 2021, I think, and it's become the go-to solution for engineers who don't want to explain to their boss why the AI features cost $5000/month in Pinecone fees.
Look, we all know the AI hype is real. Every product manager wants "semantic search" and "RAG applications" yesterday. Instead of spinning up another service that'll cost you an arm and a leg, pgvector lets you add vector search to your existing PostgreSQL database. You know, the one that's been rock-solid for the past decade.
Why Everyone's Moving to pgvector
The main reasons engineers pick pgvector over managed vector databases:
- It stores vectors up to 16,000 dimensions (which covers 99% of embedding models you'll actually use)
- HNSW and IVFFlat indexes for fast similarity search (HNSW is usually better unless you're broke and can't afford the RAM)
- Works with regular SQL queries so you can combine vector search with WHERE clauses without writing some proprietary query language
- ACID transactions because your data integrity actually matters in production
- Uses PostgreSQL tooling you already know instead of learning another database admin interface
Version 0.8.x Finally Fixed the Shit That Mattered
pgvector 0.8.x finally fixed the shit from earlier versions (I think 0.8.0 dropped in like November 2024, maybe?):
- Way faster queries than 0.7.x (which was painfully slow with any WHERE clauses - like watching paint dry)
- Actually returns complete results for filtered searches (0.7.x would return like 3 results out of 50 and call it a day)
- Iterative index scans so combining vector search with filters doesn't return garbage anymore
- Less terrible query planning because PostgreSQL's cost estimation was completely fucked with vectors before
Translation: it actually works in production now instead of just demos.
Where You Can Actually Use It
pgvector is available pretty much everywhere PostgreSQL runs:
Cloud Providers (the easy button):
- Amazon RDS - works but you'll wait forever for new versions
- Google Cloud SQL - decent support, reasonable pricing
- Azure Database for PostgreSQL - supports Flexible Server configs
Managed PostgreSQL Services (often better than cloud giants):
- Supabase - enable with one click, great for prototyping
- Neon - serverless PostgreSQL that doesn't suck
- Timescale Cloud - if you need time-series data with vectors
- Crunchy Bridge - reliable managed PostgreSQL
Installation Methods:
- Docker (recommended for dev work)
- Package managers (Homebrew, APT, Yum, conda-forge)
- Compile from source if you hate yourself
Programming Languages:
Client libraries for like 20+ languages including Python, JavaScript, Go, Rust, and Java. Python library is solid with proper NumPy integration. JavaScript works fine but watch out for type issues. Go library is decent if you enjoy writing verbose SQL everywhere. Rust has all the features but enjoy your 10+ minute compile times. Java library works fine if you're stuck in Spring Boot hell - integrates with JDBC and Hibernate without much drama.
Bottom line: if you're already running PostgreSQL and need vector search, pgvector is probably your best bet. Unless you're Google or have unlimited budget, in which case knock yourself out with the fancy stuff.
But before you jump in, you need to understand what you're actually getting into - the capabilities, the limitations, and the production gotchas that'll bite you if you're not careful.