Periodically, we must compact this fragmented page, moving tuples around to consolidate free spaces
A Slotted Page is a structure designed to efficiently manage variable-length tuples within a page. It solves limitations of traditional page classes by keeping metadata in a slot array.
struct Slot {
uint16_t offset; // Start position of the tuple in the page.
uint16_t length; // Length of the tuple data.
};
A Slotted Page contains:
slots enable direct access to any tuple by index
class SlottedPage {
std::unique_ptr<char[]> page_data; // Array to store page data.
std::vector<Slot> slots; // Slot array for metadata.
size_t free_space_offset; // Offset for free space.
};
When adding a tuple: