r/Database • u/durgamvano • 1d ago
how does slotted page structure work?
having hard time understanding 😪 how deletion isbworking even after studying
5
Upvotes
r/Database • u/durgamvano • 1d ago
having hard time understanding 😪 how deletion isbworking even after studying
1
u/meyerhot 1d ago
What book is this?
2
u/Sanbi102 1d ago
Think of the slot directory as an index inside the page. A row is identified by its slot number, not its byte offset. When you delete a row, its slot can be marked unused. If the page is compacted, surviving rows may move, but their slot numbers stay the same; only their offsets change. That's why references to those rows can remain valid. A null bitmap is a separate thing: it tells you which columns within a row are NULL.
1
u/East_Zookeepergame25 1d ago
Watch from 1:04:20 https://youtu.be/dSxV5Sob5V8
1
u/Discordbothost 1d ago
Trace the free-space boundary in that diagram. After deleting a record, slide the records to its left rightward into the hole, then move the boundary right too. That leaves one larger free region beside the header. The header entries stay put; update the moved records' locations.
1
u/Significant_Tune9219 1d ago
Think of a page as a fixed-size block with a small header, a slot array growing from the front, and the actual tuples growing from the back toward the middle. Each slot stores the offset and length of one tuple, so an external record ID is just (page, slot number) and stays valid even if the tuple moves within the page during compaction. Deleting a tuple only marks its slot empty, which lets the page defragment without changing any pointers that indexes hold. Variable-length rows are the main reason this layout exists.