Generative AI Tutorial 0/80 lessons ~6 min read Lesson 43
Vector Databases
A vector database stores embeddings and finds nearest neighbours fast — the core operation behind RAG, semantic search, and recommendation.
Course progress0%
Focus
6 guided sections
Practice signal
Examples included
Career prep
Foundation builder
Introduction
A vector database stores embeddings and finds nearest neighbours fast — the core operation behind RAG, semantic search, and recommendation. Modern options range from managed (Pinecone) to self-hosted (Qdrant, Chroma) to Postgres extensions (pgvector).
Beginner analogy: Like a search engine, but it indexes meaning instead of keywords.
Understanding the topic
Core concepts to understand:
- Pinecone — managed, fast, easy.
- Chroma — open-source, great for prototyping.
- Qdrant, Weaviate, Milvus — open-source, production-grade.
- pgvector — Postgres extension, lives in your existing DB.
- Lovable Cloud (Supabase) ships pgvector — perfect for app DB + vectors in one.
Syntax reference
Visual workflow / architecture:
bash
Vectors Index─────── ───────v1 [0.1,...] → HNSW / IVFv2 [0.3,...] → k-NN searchv3 [0.9,...]...│query ──┘│▼top-k similar vectors
Real-world use
Notion AI reportedly uses pgvector. Perplexity uses Pinecone. Vercel docs Q&A uses Postgres + pgvector. OpenAI's Assistants API abstracts the vector DB.
Best practices
- Start with pgvector if you already have Postgres — fewer moving parts.
- Pick HNSW index for speed; IVF for memory.
- Always benchmark recall@k on your real queries.
Hands-on exercise
Interview preparation — practice these questions:
- Q1. What does a vector database do?
- Q2. Compare pgvector vs Pinecone.
- Q3. What is HNSW?
Ready to mark this lesson complete?Track your journey across the entire course.