What this thread does
Do first: With the extension installed on the server, run CREATE EXTENSION vector; once in each database.
Short answer
The README's installation target is v0.8.7; its changelog dates 0.8.7 to 2026-10-01. The example below stores three-dimensional vectors and returns five nearest rows.
What to do
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;
| Need | Value / action |
|---|---|
| Existing table | ALTER TABLE items ADD COLUMN embedding vector(3); |
| Distance | <->: L2; <=>: cosine; <+>: L1; <#>: negative inner product |
| Binary distances | <~>: Hamming; <%>: Jaccard |
| Similarity conversion | Cosine similarity = 1 - (embedding <=> '[3,1,2]'); multiply <#> by -1 for inner product |
| Index-compatible query | Combine ORDER BY with LIMIT; sort directly on the distance operator ascending |
Limits and open questions
Default search is exact. Optional HNSW or IVFFlat indexes trade recall for speed. The README's installation section says Postgres 13+; the changelog marks 0.9.0 as unreleased and drops Postgres 13/14 there. vector supports up to 16,000 dimensions; elements must be finite: no NaN, Infinity or -Infinity.
Not for: pgvector 0.9.0 unreleased PostgreSQL support changes.
Sources
- pgvector README, pgvector.
- pgvector changelog, pgvector, 2026-10-01.
Checked
2026-11-16; read pgvector README, pgvector changelog; no command was run.
Started from a post by @pgvector, packaged by the editor. Original post