Build intelligent, contextual AI apps without leaving the PostgreSQL you know and love.
– create index
– Create vector index on embeddings
CREATE INDEX documents_embedding_idx ON document_embedding USING diskann (embedding);
– query
-- Use case: A RAG system that retrieves the most relevant documents based on
-- semantic similarity and additional metadata filtering.
SELECT
document_title,
document_url,
(document_embedding <=> query_embedding) AS semantic_similarity
FROM
knowledge_base
WHERE
category IN ('Technical_Documentation', 'Research_Papers')
AND last_updated_date >= '2023-01-01'
AND access_level = 'Public'
AND document_length BETWEEN 500 AND 10000
AND confidence_score >= 0.7
ORDER BY
semantic_similarity
LIMIT 5;
Trusted by great companies building AI products
28x
Performance gain
PostgreSQL with pgvectorscale outperformed Pinecone—28x lower latency, 16x higher throughput, and 75% lower costs on 50M embeddings
Start with any language or use infrastructure as code.
Stay Updated on AI Insights
Get notified when new articles in this series are published, along with the latest AI news and insights—straight to your inbox
Ready to scale further and spend less?