pgvector
pgvector Postgres extension. Covers vector types, distance operators, indexing (HNSW/IVFFlat), and client library usage. Use when storing vectors in PostgreSQL, running nearest-neighbor searches, or configuring HNSW/IVFFlat indexes. Keywords: pgvector, PostgreSQL, vector search, HNSW, IVFFlat.
How do I install this agent skill?
npx skills add https://github.com/itechmeat/llm-code --skill pgvectorIs this agent skill safe to install?
- Gen Agent Trust Hubwarn
The skill provides instructions for installing and using the pgvector extension. It includes commands that require elevated system privileges (sudo/Administrator) and directs the download and execution of code from an external repository. Additionally, the skill's metadata contains an anomalous future release date and versioning inconsistencies.
- Socketpass
No alerts
- Snykpass
Risk: LOW · No issues
- Runlayerwarn
4/12 files flagged
What does this agent skill do?
pgvector
PostgreSQL extension for storing vectors and running exact/approximate nearest-neighbor search in SQL.
Quick Navigation
- Installation:
references/installation.md - Core concepts and SQL recipes:
references/core.md - Indexing (HNSW / IVFFlat) and tuning:
references/indexing.md - Filtering, iterative scans, and performance:
references/performance-and-filtering.md - Types and functions reference (vector/halfvec/bit/sparsevec):
references/types-and-functions.md - Troubleshooting:
references/troubleshooting.md - Client libraries (priority):
- Python:
references/python.md - Go:
references/go.md - Node (JS/TS):
references/node.md - Java:
references/java.md - Swift:
references/swift.md
- Python:
When to Use
- You need vector similarity search inside Postgres (keep vectors with relational data).
- You want SQL-native ANN indexes (HNSW or IVFFlat) with tunable recall/speed.
- You want consistent patterns to store/query embeddings across multiple application languages.
Quick Start (already installed)
Prerequisite: pgvector is installed on the Postgres server. See: references/installation.md.
Enable per database and run a first query:
CREATE EXTENSION vector;
CREATE TABLE items (id bigserial PRIMARY KEY, embedding vector(3));
INSERT INTO items (embedding) VALUES ('[1,2,3]'), ('[4,5,6]');
SELECT * FROM items ORDER BY embedding <-> '[3,1,2]' LIMIT 5;
Choosing distance operators
- L2 (Euclidean): use
<-> - Inner product: use
<#>(note: returns negative inner product) - Cosine distance: use
<=> - L1: use
<+> - Binary vectors: Hamming
<~>/ Jaccard<%>
Indexing rules of thumb
- Exact search: no pgvector index; may use parallel scan on large tables.
- ANN search:
- Prefer HNSW for better speed/recall, higher build time/memory.
- Use IVFFlat when you need faster builds/lower memory.
- Create one index per distance function/operator class you plan to use.
Critical Prohibitions / Gotchas
- Approximate indexes can change results (recall vs speed).
- Index usage typically requires
ORDER BY <distance-op> ... LIMIT .... <#>returns negative inner product; multiply by-1to get the actual value.NULLvectors are not indexed; for cosine distance, zero vectors are not indexed.
Release Notes
0.8.7(2026-10-01) is a fix release: a race between HNSWINSERTandVACUUMthat could return duplicate neighbors, a buffer overflow in IVFFlat index builds with hardened index entry points, improvedvector_combine, and a fix for theavgaggregate when no rows match. Casts betweenvector,halfvec, andsparsevecwere tightened and safety-checked, and-ffp-contract=fastwas added toPG_CFLAGSto enable multiply-and-add.
Links
- Docs / repo: https://github.com/pgvector/pgvector
- Client libs:
- Releases/tags: https://github.com/pgvector/pgvector/tags
How can the creator link this skill?
Add the canonical catalog link to the repository README so users can inspect current installs and available audits. The publishing guide covers the complete discovery path.
<a href="https://skillzs.dev/skills/itechmeat/llm-code/pgvector">View pgvector on skillZs</a>