My default · Postgres extension · Vectors in your app's database

pgvector

Embeddings next to the data they describe, for when a user is waiting for the answer.

pgvector is my default for embeddings because the vectors live with the business data. One query can join, filter by tenant and permissions, mix keyword and semantic search, and answer in milliseconds.

Use it when

  • Product or document search inside an app, a support chatbot over a client's knowledge base, 'similar items', duplicate detection.
  • Results must be filtered by permissions, client, status or dates with SQL joins and row-level security.
  • Keyword and semantic search together (hybrid).
  • Answers in milliseconds (about 3–9 ms).
  • Up to a few million vectors.

Don't use it when

  • Tens of millions of vectors queried rarely: the index must fit in RAM (10M vectors ≈ 77 GB). Use S3 Vectors.

Pricing

Mostly the storage on a Postgres you already pay for: about $5 a month for 1M vectors on an existing Neon database.

Gotchas, with fixes

Gotcha: The HNSW index has to fit in memory, so large collections force a big, always-on database.

Fix: Keep the hot data in pgvector and move the archive to S3 Vectors. Watch Neon's Lakebase Search, which keeps the index on disk.

Instead, consider

Worked examples

Where it fits

Sources

Last reviewed by Nicolas Dao

Want this stack in your AWS account?

Cloudless Labs is a Sydney consultancy. We migrate on-premises systems to AWS, build serverless apps on this stack, and coach teams to ship with Claude Code and Codex.

Contact Us

For general inquiries, please contact us at:

For e-learning capabilities, please contact: