WEEK 3
pgvector + Supabase + Drizzle
Queries stored embeddings inside Supabase PostgreSQL using the <=> cosine distance operator from the pgvector extension — no in-memory math, real database I/O.
OPERATOR embedding <=> query::vectorpgvector cosine distance (lower = more similar)
COLUMN TYPE vector(1536)PostgreSQL column storing 1536 floats per row
SIMILARITY 1 - (embedding <=> q)Convert distance → similarity (0 to 1)
Query the Vector Database all chars tokens
How does cosine similarity measure relevance? What is text chunking and why does it matter? How do LLMs retrieve documents from a database? Explain vector embeddings in simple terms
Week 2 vs Week 3 Comparison Week 2 — In-Memory Vectors stored in React state (RAM only) Lost on page refresh Cosine math runs in browser JS Cannot scale beyond current session Week 3 — pgvector / Supabase Vectors persisted in PostgreSQL Survives restarts, accessible to any client Cosine math runs in the database engine Can index millions of rows with HNSW/IVFFlat