
Pgvector Semantic Search
This is the reference implementation for pgvector semantic search. It defaults to HNSW indexes with halfvec storage for cosine distance, which gives you 50% smaller indexes and solid recall without much tuning. The guide is opinionated in the right ways: it tells you to skip IVFFlat unless you have write-heavy workloads, gives you actual ef_search numbers tied to recall tradeoffs, and includes rough capacity estimates so you know when 16GB RAM hits its limit around 2-3M vectors at 1536 dimensions. If you're building RAG or any embeddings-based search on Postgres, this cuts through the parameter space and gets you to production faster.
- skills.sh installs
- 991
- GitHub stars
- 1.9K
- last updated
- Aug 21, 2026
Install
$ npx -y skills add timescale/pg-aiguide --skill pgvector-semantic-search --agent claude-codeInstalls into .claude/skills of the current project.
Files
pgvector for Semantic Search
Semantic search finds content by meaning rather than exact keywords. An embedding model converts text into high-dimensional vectors, where similar meanings map to nearby points. pgvector stores these vectors in PostgreSQL and uses approximate nearest neighbor (ANN) indexes to find the closest matches quickly—scaling to millions of rows without leaving the database. Store your text alongside its embedding, then query by converting your search text to a vector and returning the rows with the smallest distance.
This guide covers pgvector setup and tuning—not embedding model selection or text chunking, which significantly affect search quality. Requires pgvector 0.8.0+ for all features (halfvec, binary_quantize, iterative scan).
Golden Path (Default Setup)
Sponsors
Details
- Repository
- github.com/timescale/pg-aiguide
- Categories
- Backend & APIs, AI & Agent Building, Data Science & ML, Debugging, Marketing & SEO, Databases
- First seen
- Jun 3, 2026