What a database is really promising
Consider the worst possible moment for a system to improvise. Money has moved, two users press save at once, the power flickers, and a report asks a question nobody imagined whe...
Guided learning track
PostgreSQL-inspired relational database built from sessions, SQL parsing, binding, planning, execution, heap storage, buffers, WAL, transactions, MVCC, indexes, vacuum, recovery, catalogs, extensibility, replication, and partitioning.
Promises And Server Shape · Tutorial 1 of 25
Start from database promises, then introduce server processes, shared memory, protocol sessions, and session lifecycle boundaries.
Consider the worst possible moment for a system to improvise. Money has moved, two users press save at once, the power flickers, and a report asks a question nobody imagined whe...
From the application side, there is only "the database": one host, one port, one name in a connection string. Inside, it is a society with rules. Client work happens in backend ...
Before a single query can mean anything, a connection has to become a session. An application opens a network connection and wants to talk in SQL, but the server cannot immediat...
Turn SQL text into relational meaning through relations, parsing, binding, names, types, schemas, and privileges.
SQL is often introduced as a convenient way to get rows out of tables. That description is practical but too small. SQL is powerful because it lets users describe a relation the...
SQL enters the database as text, which is easy for people to write but unusable for an executor. The string contains spaces, keywords, identifiers, operators, literals, comments...
After parsing, a SQL statement has shape but not yet meaning. The tree may say that a query selects `balance` from `accounts`, compares it to a literal, and orders by `created_a...
Explain how analyzed queries become logical alternatives, costed physical plans, and iterator-style executor tuple flow.
An analyzed query knows what every name and expression means, but it still resembles the user's sentence. Planning begins by moving from sentence shape to relational structure. ...
Query planning matters because equivalent plans are not equally fast. Two plans can produce the same rows and still differ by seconds, by minutes, or by an outage. A Postgre-lik...
A plan is a promise about how to produce rows. The executor is the machinery that keeps that promise. It opens plan nodes, asks them for tuples, passes those tuples upward, and ...
Move from tuples and pages to buffer pools, write-ahead logging, and transaction commit as a durable storage promise.
The executor thinks in tuples, but disks and memory move in pages. Heap storage is the layer that turns table rows into bytes arranged inside fixed-size blocks. This is where a ...
Heap pages live on disk, but a database that touched disk for every row would be unusable. The buffer pool is the shared memory region that holds copies of disk pages while back...
Durability sounds simple from the outside. After commit, the data should not vanish. The straightforward way to deliver that is too slow inside a database. Writing every changed...
A transaction lets users treat several actions as one change. You transfer money by debiting one account and crediting another. You create an order, reserve inventory, and recor...
Show how MVCC, locks, indexes, index maintenance, and vacuum coordinate concurrent access while carrying historical versions.
Multi-version concurrency control starts from a practical goal: readers should not have to stop the world to get a stable answer. Instead of overwriting rows in place and forcin...
MVCC lets readers and writers avoid many direct conflicts, but a database still needs coordination everywhere. A table cannot be dropped while another session scans it. Two proc...
An index lets the database find candidate rows without reading the whole table. It is not a second copy of the table in a prettier format. It is a maintained access path, tuned ...
Indexes answer reads quickly, but they cost something on every write. Each insert, update, and delete must keep every relevant index consistent with the heap's versioned reality...
MVCC lets the database keep old tuple versions so readers can see a stable past. Vacuum is the process that decides when the past can be physically removed. Without vacuum, ever...
Connect checkpoints, crash recovery, system catalogs, functions, operators, and extensions into a self-describing database core.
A database crash is not exceptional in the design. It is expected. Power can fail after WAL reaches disk but before data pages do. The operating system can stop the process whil...
A relational database holds more than data. It also holds descriptions of that data. Tables have columns, columns have types, indexes belong to tables, functions accept argument...
A database becomes much more powerful when its behavior is not sealed at compile time. Postgre-like systems treat functions, operators, types, casts, aggregates, and index suppo...
Relate isolation levels, replication streams, partitioning, and distributed table shape to ordered change and query routing.
Transactions make changes feel atomic, but isolation decides how transactions overlap. This is where databases stop being simple state machines and start managing concurrent tim...
Replication begins with a practical concern. A database should not be a single fragile point. A standby can take over after failure, serve read traffic, back up data, or feed do...
Partitioning starts with a table that has grown too large or too busy to manage as one physical object, or that divides naturally along some boundary. To the user the logical re...
Assemble the full PostgreSQL-like machine from client messages through durable state, visibility, metadata, and scale.
By now the database no longer looks like a black box behind a port. It looks like a layered machine that turns statements into durable, queryable state. Each layer has a narrow ...