The Database Box: Architecture & ACID
What Data Base 2 adds to the SQL you already know — the layered machine inside the DBMS, the transaction as an atomic unit of work, the four ACID properties, and exactly which module is on the hook for each. Plus the shape of the written exam, read off fourteen real papers.
01 · Motivation
What DB2 adds to what you already know
Data Bases 1 taught you to use a database — the relational model, SQL, relational algebra. Data Bases 2 opens the box and asks how the thing actually works, and what it costs.
You already know how to write a query. What you do not yet know is what happens in the seconds after you press enter: which physical structures the data sits in, how the system decides between a hundred equivalent ways to compute your answer, what stops the other four hundred users from corrupting your rows while you read them, and what guarantees survive somebody tripping over the power cable.
That is the whole syllabus, and it splits into two halves that the course keeps returning to:
Opening the database box
Physical data management and query optimization · transaction management · concurrency control (theory and locking) · reliability control (log and recovery). The machine underneath SQL.
Opening the application box
Mapping objects to tables and methods to transactions · keeping object state in memory aligned with data in secondary storage · building advanced queries. The machine above SQL.
The prerequisites are exactly what you would guess: the relational model, SQL-92, relational algebra, plus basic object-oriented design in UML and Java for the second half.
Why this ordering
Every topic in this course is a consequence of one fact — data lives on disk and disks are about ten thousand times slower than memory. Physical structures exist to touch fewer blocks. Optimization exists to pick the plan that touches fewest. Buffering exists to avoid touching them twice — and buffering, being volatile, is precisely what makes recovery hard. Concurrency exists because a system that served one user at a time while waiting on disk would be unusable.
02 · Architecture
Opening the database box
One figure organizes this entire course. Every later chapter lives inside one of its boxes, and it is worth being able to redraw it from memory.
A query descends a stack of managers, each one translating the request into the vocabulary of the layer below. Alongside that data path sit three managers whose job is not to move data but to make promises about it.
Read it top to bottom on the left:
- The Query Manager receives
select,insert,delete,update. It parses, optimizes, and turns one declarative statement into a program of read/write requests. Chapter 4 is entirely about how it chooses. - The Access Method Manager receives
readandwriteon records and knows how each table is physically organized — sequentially, hashed, or in a B+ tree. Chapter 3. - The Buffer Manager receives
fixandunfixand owns main memory. It caches disk blocks as pages and decides when a modified page goes back to disk — a decision that turns out to determine what recovery must do. Chapters 3 and 8. - The Secondary Store Manager talks to the disk in blocks, and is the only layer that actually performs I/O.
And on the right, the three guarantors:
- The Transaction Manager receives
begin,commit,abortand delimits units of work. - The Concurrency Control System holds the lock tables and timestamps that keep simultaneous transactions from interfering. Chapters 5, 6 and 7.
- The Reliability Manager owns the log and runs recovery after a crash. Chapter 8.
The buffer is not a cache you can ignore
It is tempting to treat the buffer manager as an implementation detail. It is not: because committed data may still be sitting in volatile memory, and uncommitted data may already have been written to disk, the buffer manager’s two policy choices are what force the existence of REDO and UNDO respectively. Chapter 8 makes that link precise; note now that the arrow between Buffer Manager and disk is the most consequential one in the diagram.
03 · Transactions
The transaction as a unit of work
A transaction is an elementary, atomic unit of work performed by an application —
conceptually wrapped in begin transaction and end transaction.
Inside those brackets, exactly one of two commands ends the transaction:
commit-work— end successfully; the effects become permanent.rollback-work— end with failure; the effects are undone as though the transaction never ran.
A system that supports the execution of transactions on behalf of many concurrent applications is called a transactional system, or OLTP — On-Line Transaction Processing.
Note the distinction between an application and a transaction: one application may open and close several transactions in sequence. The transaction is the unit of atomicity, not the program.
The textbook example is a bank transfer, and it repays a careful look:
begin transaction;
update Account set Balance = Balance + 10 where AccNum = 12202;
update Account set Balance = Balance - 10 where AccNum = 42177;
commit-work;Two update statements, one transaction. The point is that no observer and no failure may ever see
a state in which the first update happened and the second did not. A variant makes the decision
conditional — read the balance back and choose:
begin transaction;
update Account set Balance = Balance + 10 where AccNum = 12202;
update Account set Balance = Balance - 10 where AccNum = 42177;
select Balance into A from Account where AccNum = 42177;
if (A >= 0) then commit-work;
else rollback-work;Here the application itself decides the outcome. A rollback may also be forced by the DBMS — for an integrity-constraint violation, or because concurrency control chose this transaction as the victim of a deadlock. Whether an aborted transaction should be retried is the application’s decision, not the system’s.
Commit is a point, not a process
The instant commit executes is the instant the transaction’s fate flips. An error strictly
before it must cause a rollback; an error strictly after it must not alter the transaction’s
effects. Almost everything in chapters 6 and 8 — long-duration write locks, the write-ahead log,
the commit rule — exists to make that single instant sharp and enforceable.
04 · Properties
ACID, and the module that guarantees each
Four properties define a transaction. Being able to name them is worth little; being able to name the module that enforces each one is the frame for half this course.
A · Atomicity
A transaction is an indivisible unit of execution: either all its operations happen, or none do. Rollback restores the state the database had before the transaction started.
C · Consistency
A transaction takes the database from one consistent state to another. Integrity constraints must hold at the start and at the end — but may be violated in intermediate states.
I · Isolation
A transaction’s execution must be independent of others running concurrently. The concurrent execution of several transactions must produce the same result as some serial execution of them.
D · Durability
Once a transaction has committed, its effect lasts — independently of any system fault. Obvious to state, awkward to deliver, since every DBMS manipulates data in volatile main memory.
Consistency deserves a second reading. It is the only property of the four that is about the data’s own rules rather than about the machinery: the sum of hours booked to tasks should equal the project’s planned hours, an account balance should not go negative. The transaction may break such a rule halfway through — while shifting work from one task to another, the total is briefly wrong — and the guarantee is only that the rule holds again at the end.
The mapping from property to module is the part to memorize:
| Property | Mechanism | Module |
|---|---|---|
| Atomicity | abort, rollback, restart, commit protocols | Reliability Manager |
| Consistency | integrity checking at query-execution time | Integrity Control (DDL compiler) |
| Isolation | concurrency control | Concurrency Control System |
| Durability | recovery management (log, checkpoint, restart) | Reliability Manager |
Two of the four land on the Reliability Manager, which is why chapter 8 covers atomicity and durability together; isolation gets three chapters of its own because that is where the exam lives.
A transaction transfers €10 between two accounts. Midway through, the sum of the two balances is momentarily wrong. Which ACID property is at stake, and is it violated?
05 · Exam
How the DB2 exam is actually built
The written exam is closed-book, two hours, no oral. A calculator is allowed; books, notes and devices are not. It contains three exercises drawn from five topics — and which five is not a coin flip.
The professors state the five examinable topics up front:
- Triggers
- Ranking and skylines
- Physical DBs and query optimization
- DB architecture and technologies — concurrency control and related
- ORM and JPA
Each paper picks three, sometimes with a short theory question attached. What the syllabus does not tell you is the selection frequency. This is where the fourteen past papers on this site — every session from January 2024 to July 2026, with official solutions — earn their keep.
Concurrency control appears in 14 of 14 sessions
Across all fourteen sessions in the question bank (2024-01-24 through 2026-07-02), every single paper contains exactly one concurrency-control exercise — no exceptions, across three years. The other two slots rotate: ranking and skylines in 9 of 14, physical DB and query optimization in 8 of 14, ORM and JPA in 6 of 14, triggers in 5 of 14. If you budget revision time by the syllabus you will under-prepare the one topic that is guaranteed to appear.
Two more facts about the format, both worth planning around:
- Every exercise is a written, multi-part procedure — classify this schedule, write these triggers, cost these plans, run this algorithm and count the accesses, fill this relationship table. Across 42 exercises there is not a single multiple-choice question. You are graded on the derivation, not the final number.
- Papers list what students on a reduced workload may omit, which doubles as the professors’ own difficulty ranking. Timestamp-multiversion concurrency control is exempted most often — in five sessions — followed by view-serializability and strict 2PL. Those are the parts they consider hardest, and they are still graded for everyone else.
Reliability is taught but has not been examined
Recovery — the log, checkpoints, warm and cold restart — is squarely in the syllabus and gets 45 slides of lectures. In the fourteen sessions on record it has never been the subject of an exercise; its only appearance is a three-point theory sub-question in February 2025. Chapter 8 covers it properly and says so explicitly. Do not skip it — but do not spend concurrency-control time on it either.
One administrative rule catches people out every year: if you reject a mark and retake the exam, the previous mark is lost — and merely sitting down and reading the exam text counts as retaking it.
06 · Context
Where DB2 sits
A short orientation, so you know what this course deliberately does not cover.
Two neighbouring courses pick up threads DB2 leaves alone. Systems and Methods for Big and Unstructured Data covers NoSQL properly — graph, document, key-value, column stores, and the design methodologies for non-relational models. Streaming Data Analytics covers data streams, time-series and complex event processing. The NoSQL material that appears in the DB2 slide pack is a recap from Data Bases 1, included for context: the 3V framing of big data, the CAP theorem, the four-family taxonomy, NewSQL, and the recent arrival of vector databases for embedding search. It is background, not examinable here.
It is also worth knowing that the relational machinery you are about to study underneath is not young. Codd’s relational model dates to 1970, System R and the first SQL to the mid-1970s, and the cost-based optimizer you will meet in chapter 4 is a direct descendant of that work. The reading in the course pack — Chamberlin’s retrospective on fifty years of query languages — traces the line from punched cards through the RAMAC disk to today.
Finally, the closing lecture makes an argument worth repeating: the operational parts of database work are increasingly automated, and what remains human is architecture, defining the guarantees (ACID and its relaxations), and judging correctness, performance and risk. That is a fair description of what this course actually trains.
Load-bearing ideas
- Everything follows from the disk. Secondary-memory access costs about four orders of magnitude more than main memory, so query cost is measured in blocks moved — and every structure, plan and buffer policy in this course is an answer to that one fact.
- The stack. Query Manager → Access Method Manager → Buffer Manager → Secondary Store Manager, with the Transaction Manager, Concurrency Control System and Reliability Manager alongside. Redraw it from memory; every later chapter is one of its boxes.
- A transaction is an atomic unit of work between
beginandcommit-work/rollback-work.commitis the instant its fate flips — errors before force a rollback, errors after must not alter its effects. - ACID → module. Atomicity and Durability are the Reliability Manager’s; Isolation is the Concurrency Control System’s; Consistency is integrity checking at query time. Consistency may be violated inside a transaction, never at its boundaries.
- The exam is three exercises from five topics, all written multi-part procedures, no MCQ. One of the three is concurrency control in 14 of 14 past sessions.
- Exam radar. Nothing in this chapter has ever been an exercise on its own — it is the framing the rest of the course hangs on. What to carry forward: the ACID-to-module table (it tells you which chapter answers which exam question) and the fact that concurrency control is guaranteed to appear.