← Lessons

quiz vs the machine

Silver1050

Databases

Storage Layout and Pages

How a database packs rows into fixed size pages on disk.

4 min read · intro · beat Silver to climb

The Page Is the Unit

A database does not read one row at a time from disk. It reads and writes whole pages, usually 4 KB, 8 KB, or 16 KB. The page is the fundamental unit of storage and the unit that the buffer pool caches.

Inside a Page

A typical heap page has a fixed layout:

  • A page header with checksums, free space pointers, and a log sequence number.
  • A slot array (line pointer array) near the start that grows downward.
  • The actual tuples (rows) that grow upward from the end.
  • Free space in the middle between the slots and the tuples.

Each slot points to a tuple by offset, so rows can be moved within the page without changing their identity. A row is addressed by a tuple id of page number plus slot number.

Why It Matters

Fixed size pages make free space management, caching, and crash recovery simple. When a row no longer fits, the engine allocates a new page and may chain overflow data separately for large values.

Key idea

Databases read and write fixed size pages, and a slotted page layout lets rows move inside a page while keeping a stable tuple id.

Check yourself

Answer to earn rating on the learn ladder.

1. What is the fundamental unit a database reads from disk?

2. What does a slot in a slotted page contain?