DatabasesDeeper

Kayavak / Databases / DB·65 Database Projects / Deeper

Deeper · Databases

Database Projects

The questions the chapter doesn't stop for: why this exists, the model to keep in your head, what changes when an assumption does, how sure we are of each claim, and what's still open. Read it after the chapter; back to the chapter.

Why does this exist?

Building a small database is one of computer science's classic learning projects, because it forces nearly every idea in this volume to fit together: a file format, an index, a query language, transactions, crash recovery. Courses at universities such as CMU (whose database systems course builds BusTub) and many self-study guides use it for that reason. The projects here combine the chapters at smaller scale, around real data and real failure.

The mental model

Try it yourself first: write your own model in the Mental Model Explorer, then compare.

A database project proves itself under concurrent writes, crashes and growth. If it's never been killed mid-write or loaded with a hundred times the test data, you don't yet know whether it works.

Question Answer
What is it? Projects that design, build, tune and break data systems
Problem it solves Turning separate chapters (modelling, SQL, indexes, transactions, recovery) into judgement
Parts Schema design, queries and plans, indexes, isolation choices, replication or backups, measurements
How it works Start with the data and the questions; build; load realistic volumes; inject concurrency and crashes; measure
Assumptions Test data resembles real data in size and skew
When they change Uniform, tiny test data hides every planner and locking problem real data reveals
Where it fails Projects that never measure plans or never test a restore
Related ideas Every chapter of this volume; TiffinBox's database stages

What if?

What if you tested with 100 evenly distributed rows?

Reason it through, then open

Every plan would be fast, every lock brief, every index optional. Real data is large and skewed: one customer with a million orders, most with a few. Skew is what breaks estimates and creates hot rows, so generate test data with realistic size and distribution.

What if you killed the database process during a batch of writes?

Reason it through, then open

A correct system recovers to a state where every acknowledged transaction is present and no partial transaction is. Doing it on purpose (and checking) is the only way to know your durability settings and application retries do what you believe.

Where the boundary is

Aspect A schema that stores the data A database design
Considers What to store What to store, how it's queried, how it changes concurrently, how it's recovered
Proven by Inserting rows Plans, load tests, concurrency tests, restore drills

How sure are we?

Claim How it's known Where from
Skewed, large data exposes planner and locking problems Measured The volume's labs (ch60, ch59)
Building a database teaches systems broadly Model Widely held by educators; consistent with learning-by-building research

Still open

How far a project needs to go (your own storage engine, or using PostgreSQL well) depends on your goal; both teach different things.

What would change your mind? If your project survived a crash test, a 100× data load and a restore drill without changes, raise the bar: add replication or a second region.

Recall

Why test with large, skewed data?

Skew and size break estimates and create hot rows that small uniform data hides.

What should a crash test show?

Every acknowledged transaction survives and no partial one does.

What makes a design more than a schema?

Accounting for queries, concurrency and recovery, proven by measurement.

Reflect

Be honest with yourself; this stays in your browser. Anything you can't tick yet is what to revisit.