Give It Memory — Vector Storage & RAG
Where AI context and memory actually live, and what they cost you.
# what you build
Models remember nothing between requests. Memory is infrastructure you build: documents split into chunks, turned into embeddings, stored in a vector database, and retrieved on every single question. You will add Postgres with pgvector, ingest a real document set, and turn the endpoint into something that answers from your data instead of guessing.
What you end up with

handles after this
~50 people at once
what it costs to run
$25–40 / month
What you will be able to do
- What an embedding is in plain words, and why it makes meaning searchable
- Chunk documents so retrieval returns the right passage, not half a sentence
- Run pgvector on managed Postgres — and when a dedicated vector database earns its keep
- Wire retrieval into the request path without doubling your latency
- Watch storage and query cost grow as the document set grows
The build, step by step
These are the chapters of the video, in order.
- 1Add the databaseManaged Postgres with the pgvector extension, locked to your app’s network.
- 2Ingest the documentsChunking that respects sentences, embeddings generated in batches.
- 3Retrieve, then answerFind the relevant passages first, and hand them to the model as context.
- 4Measure the damageLatency before and after retrieval, and the cost per thousand documents.
The stack
- Postgres
- pgvector
- Embeddings
- RDS
- Python
# before this one
This project continues the system built in 02 · Containerize the Model — Docker & a Private Registry. You can start here, but the repo assumes the previous rung exists.
$ subscribe --new-articles
Get new articles in your inbox
One email when a new hands-on guide goes live — Kubernetes, AWS, CI/CD, MLOps. No spam, unsubscribe anytime.