1. Slotted Pages

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.

Slot Array and Metadata

Slot Structure

struct Slot {
    uint16_t offset;  // Start position of the tuple in the page.
    uint16_t length;  // Length of the tuple data.
};

Slotted Page Class

A Slotted Page contains:

Screenshot 2025-01-27 at 6.33.35 PM.png

Slotted Page Structure

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.
};

2. Adding Tuples to a Slotted Page

When adding a tuple:

  1. Check if there is enough space.