Vector search inside the database you already run
pgvector adds a vector data type and similarity search to PostgreSQL. It lets you store AI embeddings next to your normal business data and query both together, which suits most semantic search and retrieval-augmented generation projects.
Keeping vectors in PostgreSQL means one database to secure, back up and query, with SQL filters, joins and permissions applied in the same statement as the similarity search. It supports approximate indexes that keep queries fast at substantial volumes. At very large scale, or with heavy concurrent vector traffic, a dedicated vector database such as Pinecone may perform better and reduce tuning work. We benchmark on your data before recommending either.
What we build with pgvector
- Semantic and hybrid search
- Retrieval-augmented generation (RAG)
- Embedding pipelines and re-indexing
- Similarity-based recommendations
- Index tuning for recall and speed
pgvector questions
Do we need a separate vector database for AI search?
Often not. If you already use PostgreSQL, pgvector handles many workloads well and keeps everything in one place. We move to a dedicated service only when scale requires it.
Can vector search respect user permissions?
Yes. Because the vectors live in PostgreSQL, the same query can filter by tenant, role or document access before returning results.
What index types does pgvector support?
It supports HNSW and IVFFlat approximate indexes. HNSW generally gives better speed and recall at the cost of more memory and slower builds, while IVFFlat builds faster and uses less memory.
Which distance measure should we use with pgvector?
It depends on the embedding model: many models are designed for cosine similarity, while others suit inner product or Euclidean distance. We match the operator and index to the model's guidance.
How do you combine vector and keyword search?
We run PostgreSQL full-text search and vector similarity together and merge the rankings, a technique known as hybrid search. It helps with exact terms such as product codes that embeddings can miss.
What happens when we change embedding models?
Vectors from different models cannot be compared, so every item must be re-embedded. We build the new embeddings in a separate column or table and switch over once they are complete.
How do you tune pgvector for accuracy and speed?
We adjust index parameters and query-time settings such as the number of candidates searched, then measure recall against exact search on a sample. That shows the real trade-off before going live.
How large can a pgvector table get?
Tables with millions of vectors are workable when indexes fit comfortably in memory and the server is sized for it. Beyond that, partitioning or a dedicated vector service may be worth considering.
Is pgvector available on managed PostgreSQL services?
Yes, most major managed PostgreSQL services, including Supabase, offer it as an extension you can enable. We confirm availability on your provider before designing around it.
How do you keep embeddings up to date?
When source content changes, a background job regenerates the affected embeddings rather than blocking the user. We store a content hash so unchanged items are not re-embedded unnecessarily.
More databases technologies
Have a project in mind? Letβs talk.
Tell us what you are building. We reply within one business day with next steps β and we are happy to sign an NDA first.