AI GLOSSARY · LOCAL AND OPEN MODELS

pgvector

Markdown version · Wikidata Q135228370

Definition

pgvector is an open-source extension for the PostgreSQL database that stores vectors (long lists of numbers, such as text embeddings) in ordinary tables and finds the nearest ones to a query vector.

Also called: pg vector, pgvector extension, postgres vector, pgvector postgres, Postgres vector search.

In plain language

pgvector adds a new kind of column to the Postgres database so that it can hold the lists of numbers (vectors) that AI tools use to represent the meaning of text or images. You can then ask the database for the rows closest to a new vector, and still use normal tables and queries beside it. For a company that already runs Postgres, that can mean one fewer system to look after. It is an add-on to a database, not a complete AI product. Fast approximate search trades some accuracy for speed, and storing many vectors adds memory and storage cost, so test with your own data before relying on it.

Technical definition

pgvector is a PostgreSQL extension, enabled in a database with CREATE EXTENSION, that adds a vector type and distance operators. Its README lists L2 distance, inner product, cosine distance, L1, Hamming and Jaccard distance. By default queries do exact nearest-neighbour search, which the README says gives perfect recall. Adding an index enables approximate search that trades some recall for speed. The README describes two index types: HNSW, a multilayer graph, and IVFFlat, which divides vectors into lists and searches a subset of them. It also says vectors sit alongside the rest of the data, with Postgres features such as ACID compliance and JOINs.

Worked examples in this catalogue

Catalogue examples point at a skill, guide or coding tool listed on this site, with what to run and what you see. An example marked illustrative describes the item from its own documentation; it was not executed for this page. Platform Scores are our assessment under a published method, not a safety guarantee.

  1. Guide · Illustrative, not executed

    What Is RAG? Retrieval-Augmented Generation Explained

    What you see
    The guide explains the indexing and query phases of retrieval-augmented generation, in which stored passages are found by similarity to the question.
    Why it exercises the concept
    A pgvector table can serve as the store that holds the vectors and answers the nearest-passage query in those phases. The guide shows the pipeline around that store.
  2. Skill by Skill Almanac · Illustrative, not executed

    rag-chunking-planner 56/100 · Provisional, not yet measuredScored · Method v0.2 · How we score

    What you see
    Your documents split by three chunking strategies, with defects and offline recall reported for each, so chunk settings are chosen with numbers.
    Why it exercises the concept
    The rows you put in a vector table are chunks. This skill helps choose chunk settings before they are embedded and stored. It does not touch Postgres.
  3. Skill by Skill Almanac · Illustrative, not executed

    library-docs-lookup 52/100 · Provisional, not yet measuredScored · Method v0.2 · How we score

    What you see
    An answer to a library question drawn from the installed package's own files, with file and line cited.
    Why it exercises the concept
    When an agent writes code that uses a pgvector client library, this skill points it at the installed package's own files rather than memory of an older API.

How it shows up when you use agents

pgvector appears when a project keeps its AI search inside the Postgres database it already runs. An agent that scaffolds a retrieval-augmented generation app may write SQL that enables the extension, creates a column for embeddings and orders rows by distance to a query vector. Supabase's documentation describes it as a Postgres extension for storing embeddings and performing vector similarity search, and mentions use in RAG.

The upside is that vectors live next to the rest of your data, so one query can filter by user, date or permission and rank by similarity. The catch, noted by Supabase, is that filtering on another column while using an approximate index can return fewer rows than you asked for. What breaks when pgvector is misunderstood: a team adds an index, sees results change and does not know that approximate search trades some recall for speed, or assumes a vector database feature such as managed scaling comes with the extension. A good next step is to run the same questions with and without the index and compare. The guide What is RAG shows where retrieval fits, and rag-chunking-planner tests what you store.

Common confusions

  • pgvector versus a vector database. pgvector adds vector search to Postgres. A dedicated vector database is a separate system built around vectors. Which suits you depends on your data and operations, so this page makes no ranking.
  • Exact versus approximate search. By default pgvector searches exactly. An index makes it approximate, which the README says trades some recall for speed.
  • HNSW versus IVFFlat. Both are approximate index types in the README. It describes HNSW as a multilayer graph and IVFFlat as dividing vectors into lists.
  • Myth. pgvector creates embeddings. It stores and compares them. A separate model produces the vectors.

Terms that mention pgvector

1 terms mention this one

More in Local and open models

Next steps

  1. What Is RAG? Retrieval-Augmented Generation Explained The long-form guide.
  2. rag-chunking-planner A skill that exercises it.
  3. Vector database Related term.
  4. Embedding Related term.
  5. All glossary terms A to Z and by family.

Sources

Definitions are written by Skill Almanac from these sources and were checked against them on 2026-11-24. Wikipedia is never the only source.

Review record

Last verified

Drafted by claude-sonnet-5-5; sources and example targets checked by claude-haiku-5-5 source check; claude-sonnet-5-5 editor pass on 2026-11-24. Last verified .

This entry is still in review, so it is not listed in search engines yet.

Change log (1)
  • : First version.