Claude Skill MartBrowse skillsQuick linesLearn by videoTerminal guideWhat is a Skill?
Back to list

pgvector Semantic Search

An opinionated playbook that teaches Claude how to build and tune vector similarity search, RAG, and semantic search on PostgreSQL with pgvector.

Dev & CodingIntermediate1,835107AI score 9/10Last updated: Sep 4, 2026

What it does

Gives Claude a concrete, benchmark-informed default for vector search in PostgreSQL.

  • Golden path: halfvec(N) columns, cosine distance (<=>), HNSW with m=16/ef_construction=64, hnsw.ef_search=100
  • Index selection: HNSW by default, IVFFlat only for write-heavy or memory-bound cases
  • Quantization: halfvec first; binary quantization to bit(N) with re-ranking for very large sets
  • Filtered search: iterative scan, B-tree prefiltering, partial HNSW indexes, or partitioning
  • Ops: bulk COPY then index, maintenance_work_mem tuning, VACUUM/REINDEX, EXPLAIN ANALYZE, build-progress queries
  • A symptom → cause → fix table for the usual pgvector failure modes

Who it's for

  • Backend/AI engineers putting a RAG or semantic search layer directly on Postgres
  • Teams already on pgvector struggling with low recall or p95 latency spikes
  • Anyone sizing memory for millions of embeddings

Examples

  1. "Create a table and index for 1536-dim OpenAI embeddings" → produces halfvec(1536) DDL, HNSW cosine index, and an explicitly cast query pattern.
  2. "My filtered query returns fewer than 10 rows" → diagnoses HNSW early termination and suggests hnsw.iterative_scan = relaxed_order, max_scan_tuples, or partial indexes/partitioning.
  3. "20M vectors on a 64GB box" → recommends binary quantization with an 80× oversampling re-rank query (800 candidates → top 10).

· · · Install guide · · ·

Try it now, no install

Paste this into Claude to use the skill without installing anything.

Read the instructions in this file and follow them to help me:
https://raw.githubusercontent.com/timescale/pg-aiguide/HEAD/skills/pgvector-semantic-search/SKILL.md

What I want: (describe your task here)

If Claude can't open the link, open it yourself and paste the contents instead.

If it works for you, download the ZIP below and install it. Then it runs on its own — no pasting each time.

Install in the Claude app (no terminal)
  1. Download the ZIP with the button below.
  2. In Claude, open Settings → Capabilities and turn on 'Code execution and file creation'. (one time)
  3. Go to Customize → Skills → + → 'Upload a skill' and upload the ZIP.
Download ZIP
Install in Claude Code

Let Claude do it — paste this into Claude Code

Install the skill I found on Claude Skill Mart.
Copy the skills/pgvector-semantic-search folder from the GitHub repo timescale/pg-aiguide into my ~/.claude/skills/pgvector-semantic-search/.
When it's done, tell me in one line what this skill can do.

Install with a command instead

git clone https://github.com/timescale/pg-aiguide.git && mkdir -p ~/.claude/skills && cp -r pg-aiguide/skills/pgvector-semantic-search ~/.claude/skills/

This is a third-party skill. Check the source repository before installing.

  1. Open a terminal.
  2. Clone the repository: git clone https://github.com/timescale/pg-aiguide.git
  3. Create the skills directory: mkdir -p ~/.claude/skills
  4. Copy the skill in: cp -r pg-aiguide/skills/pgvector-semantic-search ~/.claude/skills/
  5. Restart Claude Code and ask something like "design a pgvector semantic search schema" to trigger it.
  6. Before applying anything, confirm your database runs PostgreSQL 15+ with pgvector 0.8.0+ (CREATE EXTENSION IF NOT EXISTS vector;).
View source on GitHubLicense: Apache-2.0