Traditional SQL databases store structured data: strings, numbers, booleans. But modern AI applications need to store and query semantic meaning — and that requires vector databases.
What is a Vector Embedding?
When you pass text (or an image) through an embedding model like OpenAI's `text-embedding-ada-002`, it converts the input into a high-dimensional numerical vector:
"Book a doctor appointment for Tuesday" → [0.0231, -0.1452, 0.8832, ..., 0.0012] (1536 dimensions)Similar concepts produce similar vectors (mathematically close in vector space). This enables semantic search: searching by meaning, not just keywords.
Vector Search with pgvector on Supabase
Supabase supports the `pgvector` extension, making your PostgreSQL database a vector store:
-- Enable the extension
CREATE EXTENSION vector;
-- Create a table with a vector column
CREATE TABLE documents (
id UUID DEFAULT gen_random_uuid() PRIMARY KEY,
content TEXT,
embedding vector(1536)
);
-- Create an index for fast similarity search
CREATE INDEX ON documents USING ivfflat (embedding vector_cosine_ops) WITH (lists = 100);Building Semantic Search
// 1. Embed the search query
const { data } = await openai.embeddings.create({
model: 'text-embedding-ada-002',
input: searchQuery
});
const queryVector = data[0].embedding;
// 2. Find similar documents using cosine distance
const { data: results } = await supabase.rpc('match_documents', {
query_embedding: queryVector,
match_threshold: 0.75,
match_count: 10
});Use Cases in Production
- AI Chatbots with domain knowledge (RAG pipelines)
- Semantic product search ("show me cozy winter clothes")
- Duplicate content detection
- Recommendation engines
Conclusion: pgvector on Supabase gives you production-grade vector search without adding Pinecone, Weaviate, or Qdrant to your stack. For most startups, this is the pragmatic, cost-effective choice.

