Slotted page (code by Claude, guidance by Georgios Evangelidis)
Records are packed from the start of the page; the slot directory grows backwards from the end, after a header holding the number of slots N and the free space pointer. A record id is (page, slot), so records can move inside the page (during compaction or a growing update) without their rid changing: only the slot's offset is rewritten.
Selected record
Slot directory
| Slot | Offset | Length | sid | name |
|---|
Operation log
Reading the diagram
Each row is 64 bytes and the page reads left to right, top to bottom. Slot i sits at page offset size − 4 − 4(i + 1). A deleted slot stays in the directory, marked empty, so the slot numbers (and rids) of the other records do not change; only trailing empty slots are removed.
Record format: an offset array of 6 two-byte entries (start of each of the 5 fields plus the end), then sid INTEGER (4), name VARCHAR(30), login VARCHAR(20), age INTEGER (4), gpa REAL (4).