Figure: Twenty questions modern data systems answer
Twenty course questions in four columns: AI agent data stacks, reads at scale, writes at scale, and trust, security, and streaming. Each question names the techniques the course uses to answer it.
CS145 starts with twenty production questions. Each answer introduces a systems technique you can reuse.
Four eras of data systems, compared on the same four questions
Figure: Four eras of data systems, compared on the same four questions
A four-column grid. The columns are Banks and retail in the 1970s to 1980s, the web from 1995 to 2010, the cloud era from 2004 onwards, and AI agents from 2025 onwards, the last one filled blue as the era the course is built for. Four rows compare them: the products of each era, who is on the other end of the query, the hard question each era had to answer, and what the industry invested in during it. The middle row escalates from hundreds of clerks, to millions reading, to billions writing at human pace, to machines at machine pace. The investments row runs from transactions and the relational model, through replicas and NoSQL and MapReduce, to LSM trees and object storage and columnar scans, to vector indexes and KV caches and lineage and Iceberg, the table format that lets any engine read the same storage.
Four eras and their periods. Banks and retail ran ledgers, inventory and airline seats, with hundreds of clerks at human pace, asking: is it correct? The web (Google, Amazon, Instagram) had millions reading, asking whether everyone could read it at once. The cloud (Gmail, YouTube, assistants) had billions writing, asking whether everyone could write and store forever. AI agents (copilots, agents) put machines reading and writing nonstop at machine pace. The investments follow in order: transactions, ACID, the relational model, locking and write-ahead logs; replicas, caches, NoSQL, consistent hashing, inverted indexes, the cluster and MapReduce; LSM trees, sharding, object storage, quorums, Iceberg and lakehouses; then vector indexes, KV caches, eval sets and lineage.
Banks and retail
The web
The cloud
AI agents
1970s TO 1980s
1995 TO 2010
2004 ONWARDS
2025 ONWARDS
Each era shifted the party issuing the query. CS145 targets the agent era.
Figure: What you need on day one, and what helps a lot
Three panels. The first, with an ink top strip marking it as required, is Python and Colab: read Python and run a notebook, needed from day one. The next two, with grey strips marking them as helpful rather than required, are CS 161 Algorithms, giving sort and hash and complexity, and CS 111 Systems, giving filesystems and the memory hierarchy and scheduling. A closing line says CS145 runs those same concepts on data 100 to 1,000,000 times bigger, and points at the ten-question concept check that opens PSET 0.
What you need. Required: Python and Colab, meaning read Python, run a notebook, open a Colab and execute a cell. Two courses help a lot without being required: CS 161 Algorithms (sort, hash, complexity; how an operation scales when the input grows), which Modules 2 and 3 lean on, and CS 111 Systems (filesystems, the memory hierarchy, scheduling; where the bytes actually live), which Module 2 leans on. CS145 takes those same concepts and runs them on data 100x to 1,000,000x bigger. PSET 0 opens with ten questions on exactly these concepts.
REQUIRED
HELPS A LOT
HELPS A LOT
Python and Colab
CS 161 · Algorithms
CS 111 · Systems
The course leans on the concepts from CS161 and CS111 more than the coursework. Use PSET 0 to check where you stand.
One week in CS145, and the eleven weeks it repeats across
Figure: One week in CS145, and the eleven weeks it repeats across
Two blocks in one picture. The top block is one week in three lanes, read top to bottom in the order you do them. LECTURES holds the two lectures, Tuesday and Thursday. PRACTICE shows section slots on Wednesday and Friday running the same Colab walkthrough. Students pick one slot; timings are on Ed. READING holds the same page used in lecture with its three to five minute video, and the week's industry case study. Between them, a line says section and the reading are the rehearsal and the PSET is the same material on your own, graded. The bottom block is the quarter: eleven week columns with the module each covers, M1 SQL through M5 Distributed, a Thanksgiving gap at week ten and industry lessons at week eleven, then two rows of real deadlines. Six PSETs: M0 Sep 25, M1 Oct 5, M2 Oct 12, M3 Oct 19, M4 Nov 9, M5 Dec 2, each landing the week after its module ends. Three project milestones: Project 1 Oct 16, the Project 2 proposal Oct 30, and Project 2 Nov 20.
The eleven weeks and the module taught in each. Weeks 1 and 2 are Module 1; week 3 covers Modules 2 and 3; weeks 5 to 7 are Module 4; weeks 8 and 9 are Module 5; week 10 is a break and week 11 is Industry.
W1
W2
W3
W4
W5
W6
W7
W8
W9
W10
W11
M1
M1
M2 · M3
M3
M4
M4
M4
M5
M5
break
Industry
PSET deadlines, each date under its PSET in the figure.
PSET M0
PSET M1
PSET M2
PSET M3
PSET M4
PSET M5
Sep 25
Oct 5
Oct 12
Oct 19
Nov 9
Dec 2
Project deadlines, each date under its project in the figure.
Project 1
P2 proposal
Project 2
Oct 16
Oct 30
Nov 20
One week, day by day. Lectures are Tuesday and Thursday. The same Colab walkthrough runs in multiple section slots on Wednesday and Friday; pick one, with timings on Ed. The reading is your own time: the lecture page in Notes plus a 3 to 5 minute video, and the week's reading list of required pages plus a case study. Section and the reading are your prep for the PSET; it is the same material, on your own, graded.
TUE
WED
THU
FRI
Lecture
Section slots
Lecture
Section slots
new material, live
Colab walkthrough
new material, live
Colab walkthrough
Section and the reading are your prep for the graded PSET. Lectures run Tuesday and Thursday; pick one section slot (timings on Ed). The bottom block is that same week across all eleven: a PSET follows its module.
One hundred points: fifty fixed, and fifty you can earn two different ways
Figure: One hundred points: fifty fixed, and fifty you can earn two different ways
A hundred-point scale. The first fifty points are fixed for everyone: Project 1 worth ten, PSets worth fifteen, Project 2 worth twenty-five. From the fifty-point mark the bar splits into two alternatives for the remaining fifty. Path 1 accrues fifteen points from nano quizzes and puts thirty-five on the final. Path 2 is a final worth fifty. A brace on the right marks that you are given whichever of the two scores higher, automatically.
Path 1, accrue points from nano quizzes: the nano quizzes are worth 15 and the final 35.
Nano quizzes
Final
15
35
Fixed for everyone, whichever path you take: Project 1 is worth 10, the PSets 15 and Project 2 25. The last column is the rule that picks your path: you get the higher score of the two.
Project 1
PSets
Project 2
You get
10
15
25
the higher
Path 2, bet on the final: the final alone is worth 50, and the scale beneath the figure runs 0, 50, 100.
Final
50
Everyone earns 50 fixed points: Project 1 for 10, PSets for 15, Project 2 for 25. The remaining 50 points come from either Path 1 or Path 2, and the course uses the higher score. Path 1 accrues 15 points from nano quizzes across the term and puts 35 on the final. Path 2 assigns all 50 to the final.
Where AI is allowed in CS145, and what is graded in each place
Figure: Where AI is allowed in CS145, and what is graded in each place
Two panels. On the left, the projects: every AI tool is allowed, credited, and the grade is on four things you do after the model answers, namely verify the answer, fix the semantics, cut the cost, and defend the design. On the right, the paper test: no AI, standing in for a whiteboard interview and measuring the systems thinking you carry yourself.
The AI policy, two settings. On the projects, use any tool you like and credit it: GPT, Claude, Gemini, whatever you prefer. The model writing the first draft is assumed, so the grade is on what you do after it answers, starting with verifying the answer is correct. On the paper test, no A I: it is the stand-in for the whiteboard job interview, so it measures the part that is now scarce, the systems thinking you carry yourself, including query semantics, what the SQL does.
On the projects
On the paper test
Use any tool you like. Credit it.
No A I.
On projects, draft your code first, then any AI tool and credit it; your grade is on verifying the answer, fixing the semantics, cutting cost, and defending the design. The paper test is AI-free, a stand-in for the whiteboard interview.
Databases give applications durable memory: data survives after a computation ends.
What this course teaches
Five you learn, then the modern systems you build
Figure: Five you learn, then the modern systems you build
Top row: five capability modules, from SQL and storage on one machine through indexing, transactions, and distributed systems across many machines. Below, M6 applies those mechanisms to phones, AI-agent memory, and modern data platforms.
The modules and the real systems each one explains. Along the way the figure names what each move buys: disk pages, a billion rows answered in milliseconds, all-or-nothing; declarative, on disk, many machines.
M1 · SQL
M2 · Storage
M3 · Indexing
M4 · Transactions
M5 · Distributed
Postgres · BigQuery
Chrome · Uber
Spotify · OpenAI
Stripe · GitHub
Netflix · Kafka
Each module adds one capability, and each one supports the next scale.
Three blue cards run from one machine to many. Small analytics starts with Pandas in memory and Polars streaming supported work. Agent memory separates working context from persistent memory. UberEats coordinates shared transactional state across many machines and saves unfinished phone actions through network failures.
The three opening teardowns. 0.1 Small analytics: Pandas and Polars on a laptop, fast until it runs out of RAM. 0.2 Agent memory: no memory, then local, then global. 0.3 A big service: UberEats, one database, three sides, plus the edge. The first row is the scale each one reaches, the second what it is here to teach. The arc runs from one machine to many machines.
0.1 · Small analytics
0.2 · Agent memory
0.3 · A big service
~16 GB on a laptop
1 user → 800 M users
billions of orders, planet-wide
the on-ramp
the whole course in one example
planet scale and the edge
Three case studies move from working state on one machine to persistent state across many machines. Modules 1 through 6 explain the mechanisms underneath.
Pandas normally materializes a DataFrame in memory.
Pandas: Deconstructing Small Analytics
How Pandas holds a DataFrame
Figure: How Pandas holds a DataFrame
Pandas reads listens.csv from disk into memory as a DataFrame with named, typed columns. The DataFrame stores each column in a typed array and materializes its data in memory.
The DataFrame in memory, 2 rows, read from listens.csv on disk. Each column is named and typed: the type row under the headers reads int64 for all three. Held column by column, each one a contiguous typed array, which is why summing a single column is fast. Every column of every row is in memory at once, which is why this is fast on small data and fails on big data.
user_id
song_id
rating
int64
int64
int64
1
12
5
1
45
4
A CSV on disk or a Parquet file reads into a DataFrame with named, typed columns. The system stores each column as its own typed array, which makes column aggregation fast. The DataFrame keeps every column of every row in memory at once, so it runs fast on small data and fails when the data exceeds memory.
Figure: Pandas: the whole dataset has to fit in RAM
Pandas reads a CSV or Parquet file into a DataFrame on one machine. Group, sort, and join operations use that machine's memory. As data and intermediate results approach the available RAM, the process may slow, swap, or fail an allocation.
Group, sort, and join execute in one process. As memory pressure grows, Pandas may slow sharply, swap, or fail an allocation. It does not automatically turn the operation into a streaming or distributed plan.
How far each engine gets on a data-size axis, and where one machine ends
Figure: How far each engine gets on a data-size axis, and where one machine ends
An illustrative data-size axis compares three execution models. Pandas normally materializes data and intermediate results in memory. Polars can stream supported operations in batches on one machine, although some operations still materialize. A distributed database divides storage and execution across machines. Actual limits depend on the query and hardware.
Where the work runs as the data grows. The ladder along the figure reads 1 GB, 10 GB, 100 GB, 1 TB, 10 TB, 100 TB, 1 PB. The marks on it are small Spotify, laptop RAM, one server's RAM, one server's disk, and the real Spotify: one machine is enough up to roughly a server's disk, and past that it needs many machines.
One machine is enough
Needs many machines
Hardware you already own
A cluster you rent
Pandas normally materializes the data and intermediate results in memory. Polars can stream supported operations in batches, which extends the range of one machine. Some operations still require materialization. A distributed engine divides storage and execution across machines when one machine no longer fits the workload.
An LLM model only sees the context supplied for its current call.
Claude & OpenAI: Deconstructing Agent Memory
Agent memory from local retrieval to a global service
Figure: Agent memory from local retrieval to a global service
Three panels left to right. A model call can miss an earlier decision when the current context does not contain it. A local agent can retrieve saved project evidence from SQLite. A global product can serve user memory from a replicated Postgres deployment supporting 800 million users.
Three stages of the same agent. Stage 1 is short-term working memory, wiped when the session ends. Stage 2 keeps it on disk, one machine, so it survives every session. Stage 3 is ChatGPT's user database: on disk, many machines, one per user across 800M. The row below is what each stage does when asked for a function.
1 · Model alone
2 · + Local memory
3 · + Global memory
✗ Hallucinates a function
✓ Looks it up · per laptop
✓ One per user · ×800M
Context (or memory) lives outside the model. The current context is short-term working memory, limited to what a single call includes. A local agent persists saved evidence in an embedded database (SQLite on one machine) that survives every session. OpenAI reports a read-heavy Postgres deployment serving 800 million users, with one primary and nearly 50 read replicas.
On Tuesday you ask the agent to extend the auth module you built on Monday. The current request does not include the earlier decision, and the agent does not retrieve the relevant code. It predicts a plausible function named verifyJWTWithScope, but the codebase contains no such function.
Monday produced a working module. Tuesday's request does not contain the earlier decision. The agent generates verifyJWTWithScope() from patterns rather than retrieved evidence. Persistent memory gives the next session something to query.
Three model calls run left to right. The first context reaches its token limit. Later calls contain only the context the application supplies. A persistent database below the calls retains saved records, and retrieval selects which records return to a later context.
The context window stays bounded at roughly 200,000 to 1,000,000 tokens. Persistent memory can retain records outside that window across sessions. The application retrieves selected records when a later request needs them.
Notes ↗Local memory: a database on your machine
Local memory: capture, store, retrieve
Figure: Local memory: capture, store, retrieve
Local agent memory. A model captures records in SQLite on your machine. Keyword search uses FTS5. Vector search can use Chroma or sqlite-vec: claude-mem documents Chroma, while QMD uses sqlite-vec. Retrieved records return to the model through the retrieval arrow.
Local memory captures records in SQLite and retrieves selected evidence into later context. The diagram shows FTS5 keyword search and Chroma or sqlite-vec for vector search. claude-mem documents an optional Chroma index; QMD uses sqlite-vec.
Global memory: one primary, nearly 50 read replicas
Figure: Global memory: one primary, nearly 50 read replicas
ChatGPT users send writes to one PostgreSQL primary. The primary replicates changes to nearly 50 read replicas across regions. Read results return from the replicas to the users. This is a simplified view of OpenAI's reported read-heavy PostgreSQL deployment.
OpenAI reports one Azure PostgreSQL primary and nearly 50 read replicas supporting a read-heavy workload for 800 million users. The primary accepts writes and replicates changes across geographic regions; the read replicas serve queries and return results to users.
Three retrieval signals feed combined fusion ranking
Figure: Three retrieval signals feed combined fusion ranking
Three vertically stacked boxes show BM25 keyword matching, vector similarity, and graph ranking. Arrows connect each signal to a fourth box for combined fusion ranking, which merges ranked candidates, removes duplicates, and selects evidence for the next context. This illustrates a possible combined pipeline, not a claim that every tool uses all three signals.
BM25 ranks stored text by term matches. Vector similarity ranks stored text by embedding distance, so "login" can match "auth." Graph ranking orders code definitions by their relationships to other definitions. The fourth box illustrates combined fusion ranking: merge ranked candidates, remove duplicates, and select evidence for the next context. This is a possible combined design; QMD and Aider do not necessarily use all three signals.
UberEats must keep the diner, driver, and restaurant in agreement while the service runs across many machines.
UberEats: Deconstructing a Big Service
UberEats: shared state for three sides
Figure: UberEats: shared state for three sides
A simplified model of a three-sided order. The diner, driver, and restaurant apps hold temporary state. A distributed transactional database coordinates the shared order, assignment, and inventory records. One transaction applies the related changes together. Green marks the persistent shared state; the apps hold only volatile state.
The client apps hold only temporary, volatile in-memory state. The green frame is the persistent shared state: a transactional database that coordinates the order, assignment, and inventory records across all three sides, so related changes apply together.
A simplified order transaction updates the payment, driver assignment, and inventory together. A successful order applies all three changes. A failed order leaves all three unchanged. The database also rejects a conflicting driver assignment so two competing updates cannot both finish successfully.
The three sides of one order, and what each one does when it commits.
DINER
DRIVER
RESTAURANT
balance charged
exactly one assigned
inventory decremented
The all-or-nothing rule underneath: the two outcomes the figure allows.
COMMIT
ANY ONE FAILS
All three apply together.
None of them do.
One transaction updates the payment, driver assignment, and inventory together. A successful order applies all three changes. A failed order leaves all three unchanged. Competing driver updates cannot both finish successfully.
Figure: The disconnected edge: save now, send later
The driver app saves an unfinished action and its latest state to disk when the phone loses its connection. After reconnecting, the app sends queued actions to the server and updates its local state if the server returns a different result. Green marks the shared server state.
The driver app saves unfinished actions to disk so they survive an app restart. It sends the queued actions after reconnecting and updates its local state to match the server.
The project path: Project 1, then one of two Project 2 options
Figure: The project path: Project 1, then one of two Project 2 options
Everyone does Project 1 (BigQuery's First Heist, solo, Sep 25 to Oct 16, 16 to 20 hours, blue) and builds decision-worthy SQL and scalable cloud analytics, then picks one Project 2 (Oct 16 to Nov 20, pairs by default with solo optional, about 40 hours per person for a Tier 93 project (about 8 hours a week over five weeks), with the Tier 100 capstone adding about 8 more): Science (NanoQuery, violet, SQL, semantic search, and text-to-SQL evaluation, an analysis combining tabular data with a knowledge base) or Systems (NanoMem, green, a search engine giving AI coding agents persistent memory that races real production tools). Each card lists focus, skills you build, and the portfolio story. Blue is the SQL foundation, violet is data science, green is systems.
Project 1 architecture: query a public dataset with SQL to answer questions
Figure: Project 1 architecture: query a public dataset with SQL to answer questions
Left to right: a read-only public dataset in BigQuery (three or more tables such as posts, users, and comments, at least 500 MB, grey) is queried by the SQL you write in a Colab notebook (a code card shows a CTE with a RANK window function and a join). It produces a result table of decision-worthy answers, one row starred as the insight. Below, you hand-trace two paper debug tables to verify how the SQL executes. Blue is what you build; grey is the read-only data you query.
A left-to-right map. The two blue boxes are CS145 itself, the content in focus: the core curriculum with Project 1, then a Project 2 choice of the Science path or the Systems path, NanoMem. The grey box is what you keep learning beyond the course, out of focus here. The green box is where it leads, the careers the path opens. Color key: blue is CS145 content, green is where it leads, grey is beyond CS145.
The journey map, each stop paired with where it leads.
Core: SQL (+ Pandas, NoSQL)
Where it leads
BigQuery, tens of GB
Data Scientist
Storage, indexes, query opt
Build a search engine
ACID, then distributed:
Founder / CTO
Core database skills build toward a project path, and each path maps to the industry roles that use it.
Notes ↗You'll read, debug, and write queries like this
One query, three parts
Figure: One query, three parts
The power-users query has three parts. The first CTE counts distinct songs, distinct genres, and total listens per user. The second keeps users spanning at least three genres and ranks them into deciles by total listens. The final SELECT joins user names and returns the top decile.
A production SQL pattern: two CTEs compute per-user aggregates and a decile rank, then an outer SELECT joins names and filters to the top decile.
Three panels show Spotify's published data-platform path. Client software publishes typed events. Event delivery uses managed queues, anonymization pipelines, and streaming jobs. Scheduled workflows run in BigQuery, Flink, or Dataflow so teams can analyze the resulting data. Color key: blue is collection, grey is movement and processing, green is analysis.
Spotify's published data platform collects typed client events, moves them through managed queues and processing jobs, and makes the resulting data available for analysis.