← Lessons

quiz vs the machine

Silver1100

Databases

The Storage Engine and Pages

The storage engine reads and writes the database one fixed size page at a time.

4 min read · intro · beat Silver to climb

The Layer Under SQL

Above the disk sits the storage engine, the component that turns rows and indexes into bytes on disk and back. The query planner decides what to fetch, but the storage engine actually moves the data. Examples include InnoDB for MySQL and the heap and btree access methods in PostgreSQL.

Pages Are The Unit

The engine never reads a single byte. It reads and writes fixed size blocks called pages, typically eight or sixteen kilobytes. A page holds many rows plus a header and a slot directory that points to each row inside it.

  • The header records page type, free space, and checksums.
  • The slot directory lets rows move within a page without changing their identifiers.
  • Reading one row pulls its whole page into the buffer pool.

Why Pages

Aligning to a page size matches how disks and the operating system move data, so a row lookup costs one page read. It also makes caching, locking, and crash recovery operate on uniform units.

Key idea

The storage engine is the layer that maps logical rows to physical pages, and the page is the fixed size unit it reads, writes, caches, and recovers.

Check yourself

Answer to earn rating on the learn ladder.

1. What is the basic unit the storage engine reads and writes?

2. What does a page slot directory enable?