Home / timescale / pg-aiguide · skills/pgvector-semantic-search/SKILL.md · GitHub

pgvector-semantic-search skillA

pgvector-semantic-search is agent-read markdown (skill) from timescale/pg-aiguide: Use this skill for setting up vector similarity search with pgvector for AI/ML embeddings, RAG applications, or semantic search. **Trigger when user asks to:** - Store or search vector embeddings in PostgreSQL - Set up semantic search, similarity search, or nearest neighbor search - Create HNSW or IVFFlat indexes for vectors - Implement RAG (Retrieval Augmented Generation) with PostgreSQL - Optimize pgvector performance, recall, or memory usage - Use binary quantization for large vector dataset.

Indexed from public GitHub and served as immutable, content-addressed versions. Install it pinned to an exact SHA-256 with the mdr CLI, and every file is verified before it reaches your agent: the main file against the SHA-256 recorded here, the others against the git hashes of its source commit. The deterministic audit below grades the latest version, and the same checks always give the same file the same grade.

What the file says

# 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)

Use this configuration unless you have a specific reason not to.
- Embedding column data type: `halfvec(N)` where `N` is your embedding dimension (must match everywhere). Examples use 1536; replace with your dimension `N`.
- Distance: cosine (`<=>`)
- Index: HNSW (`m = 16`, `ef_construction = 64`). Use `halfvec_cosine_ops` and query with `<=>`.
…

Read the whole file at its exact version.

How to install

Latest version
mdr add timescale/pg-aiguide/pgvector-semantic-search@git:20260407.0da8f4e
Exact content
mdr add timescale/pg-aiguide/pgvector-semantic-search@sha256:0c23028b9bc8f9a8

Pin to a label to follow the author's releases, or to a sha256 for exact bytes. Either way the resolved hash is written to mdr.lock, and mdr install fetches those bytes again and checks them, so it installs them exactly or fails.

Badge

mdr badge

[![mdr](https://markdownregistry.com/badge/art_tf3htybvstl7qfou.svg)](https://markdownregistry.com/a/art_tf3htybvstl7qfou)

2 badge views in 30 days

Versions

versioncommittedcommitsizeaudit
git:20260407.0da8f4e latest2026-04-07 0da8f4e 15,106 BA view · diff
git:20260202.cb628262026-02-02 cb62826 14,989 BA view · diff
git:20260128.fb361012026-01-28 fb36101 14,238 BA view

Audit of the latest version

A  17 of 17 checks passed. Deterministic, no model, same answer every run.
  • pass: Frontmatter block present
  • pass: Frontmatter declares a name
  • pass: Frontmatter declares a description
  • pass: Size between 200 bytes and 200 KB (15106 bytes)
  • pass: No zero-width or bidi control characters
  • pass: No instruction hidden inside an HTML comment
  • pass: No link to an exfiltration or paste host
  • pass: No credential-shaped string
  • pass: No instruction to send local credentials anywhere
  • pass: No text hidden with inline styles
  • pass: No prompt-injection phrasing
  • pass: No curl or wget piped into a shell
  • pass: No recursive delete of root, home or parent
  • pass: No instruction to read or print local credentials
  • pass: No base64 blob over 200 characters
  • pass: No link to a raw IP address
  • pass: No script tag

Source

GitHub

timescale/pg-aiguide · 1,849 stars · license Apache-2.0 · pushed 2026-09-25 · branch main

API

GET https://markdownregistry.com/api/v1/artifacts/art_tf3htybvstl7qfou
GET https://markdownregistry.com/api/v1/resolve?ref=timescale/pg-aiguide/pgvector-semantic-search
GET https://markdownregistry.com/api/v1/blob/0c23028b9bc8f9a8bc4f45042d5996877533f60d7798a074ce73373ebc3e24f6

Your agent does the legwork. You hear about the deals worth your word. Hand yours the standing instructions at modelranch.com and it joins the network that reads files like this one.

More from timescale/pg-aiguide

CLAUDE.md claude
timescale/pg-aiguide · CLAUDE.md
git:20260908.2bf9f11 · audit A · 1,849 stars
design-postgis-tables skill
timescale/pg-aiguide · skills/design-postgis-tables/SKILL.md · Comprehensive PostGIS spatial table design reference covering geometry types, coordinate systems, spatial indexing, and…
git:20260407.0da8f4e · audit A · 1,849 stars
design-postgres-tables skill
timescale/pg-aiguide · skills/design-postgres-tables/SKILL.md · Use this skill for general PostgreSQL table design. **Trigger when user asks to:** - Design PostgreSQL tables…
git:20260407.0da8f4e · audit A · 1,849 stars
find-hypertable-candidates skill
timescale/pg-aiguide · skills/find-hypertable-candidates/SKILL.md · Use this skill to analyze an existing PostgreSQL database and identify which tables should be converted to…
git:20260407.0da8f4e · audit A · 1,849 stars
migrate-postgres-tables-to-hypertables skill
timescale/pg-aiguide · skills/migrate-postgres-tables-to-hypertables/SKILL.md · Use this skill to migrate identified PostgreSQL tables to Timescale/TimescaleDB hypertables with optimal configuration…
git:20260407.0da8f4e · audit A · 1,849 stars
postgres-database-migration skill
timescale/pg-aiguide · skills/postgres-database-migration/SKILL.md · Use this skill for planning, testing, and safely executing PostgreSQL schema migrations — especially when working with…
git:20260904.64c743b · audit A · 1,849 stars
postgres-hybrid-text-search skill
timescale/pg-aiguide · skills/postgres-hybrid-text-search/SKILL.md · Use this skill to implement hybrid search combining BM25 keyword search with semantic vector search using Reciprocal…
git:20260407.0da8f4e · audit A · 1,849 stars
postgres skill
timescale/pg-aiguide · skills/postgres/SKILL.md · Use this skill for any PostgreSQL database work — table design, indexing, data types, constraints, extensions…
git:20260925.2209242 · audit A · 1,849 stars
schema-exploration skill
timescale/pg-aiguide · skills/schema-exploration/SKILL.md · Explore an existing PostgreSQL database before answering questions about its data or writing SQL. Use this skill…
git:20260925.2209242 · audit A · 1,849 stars
setup-timescaledb-hypertables skill
timescale/pg-aiguide · skills/setup-timescaledb-hypertables/SKILL.md · Use this skill when creating database schemas or tables for Timescale, TimescaleDB, TigerData, or Tiger Cloud…
git:20260407.0da8f4e · audit A · 1,849 stars

Every file in timescale/pg-aiguide

Browse by kind, by grade A, or by owner.