Back to lab
Experiment

A 200-line RAG that beats most demos

A small Postgres + pgvector retrieval pipeline that we keep reaching for on Day 2 of every prototype.

Most ‘RAG demos’ ship 1,200 lines of LangChain when 200 lines of Postgres do the job. Here is the pattern we keep using on Day 2 of prototypes.

Schema: one table for chunks, one column for the embedding, an HNSW index, and a simple top-k query with cosine distance. That is it.

Where this loses: very large corpora (>10M chunks), cross-encoder reranking, and exotic hybrid retrieval. For most studio prototypes, none of those matter on Day 7.

Want this kind of work for your own product? Start a project.

Start a project