MySQL
database
storage
page
data management

MySQL What is a page?

System Design practice on Codemia

Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.

Practice system design

Introduction

In MySQL, especially when people talk about InnoDB, a page is the basic unit of storage and I/O. MySQL does not usually read or write one row at a time on disk; it works with fixed-size pages that contain rows, index entries, and metadata.

If you understand pages, many database behaviors become easier to explain: buffer pool caching, page splits, clustered indexes, and why row size affects performance even when the query touches only a few columns.

What a Page Means in InnoDB

In InnoDB, a page is a fixed-size block inside a tablespace. The default page size is typically 16KB, and it is the smallest chunk InnoDB uses for many storage operations.

You can inspect the configured page size with:

sql
SHOW VARIABLES LIKE 'innodb_page_size';

A page can store:

  • table rows
  • clustered index records
  • secondary index entries
  • undo information
  • internal metadata

So when someone says "the row is on a page," they usually mean "the row is stored inside an InnoDB page that belongs to some B-tree structure."

Pages and B-Trees

InnoDB stores tables and indexes as B-trees. Each node of the tree is backed by one or more pages.

For a table that uses the default clustered primary key layout:

  • leaf pages of the clustered index contain the actual row data
  • internal pages contain navigation keys and child pointers
  • secondary index leaf pages contain secondary key values plus the primary key

That distinction explains a lot of query behavior. A lookup on the primary key can go directly to the clustered index page containing the row. A lookup on a secondary index often requires:

  1. reading the secondary index page
  2. finding the primary key stored there
  3. following that primary key into the clustered index page

That extra step is why secondary-index lookups can involve more page access.

A Simplified Page Layout

An InnoDB page is not just a bag of rows. It contains several regions for housekeeping and navigation.

A simplified mental model looks like this:

  • file and page headers
  • special boundary records
  • user records or index entries
  • free space
  • page directory
  • trailer or checksum-related data

You do not need to memorize byte counts to work effectively with MySQL, but you should know that every page contains both payload and overhead. That overhead is one reason row format and index width matter.

Why Pages Matter for Performance

Pages are central to performance because the buffer pool caches pages, not individual rows.

When a query needs one row, InnoDB usually loads the whole page containing that row into memory. If nearby rows live on the same page, access can be cheap. If rows are scattered across many pages, random I/O and cache pressure increase.

This also explains why a covering index can be powerful. If all needed columns are present in the index leaf page, MySQL may avoid an extra trip to the clustered index page.

You can see the difference with a table like this:

sql
1CREATE TABLE orders (
2    id BIGINT PRIMARY KEY,
3    customer_id BIGINT NOT NULL,
4    created_at DATETIME NOT NULL,
5    total_cents INT NOT NULL,
6    INDEX idx_customer_created (customer_id, created_at)
7) ENGINE=InnoDB;

A query selecting only customer_id and created_at may be satisfied from the secondary index pages alone. A query selecting every column may need to visit the clustered index pages too.

Page Splits and Fragmentation

Pages also explain why inserting data in random key order can hurt write performance.

When a page fills up and InnoDB needs to insert a new record into the middle of its sorted order, it may have to split the page. That means moving records around and updating B-tree pointers.

Sequential primary keys reduce this problem because inserts usually go near the end of the clustered index. Random UUID-style keys can cause more page splits and wider write amplification unless you use a layout designed to preserve locality.

Pages and the Buffer Pool

The InnoDB buffer pool is an in-memory cache of pages. When people tune innodb_buffer_pool_size, they are tuning how many pages InnoDB can keep hot in memory.

That is why a workload with many small, scattered reads can still be page-heavy. Even if the application thinks in terms of individual rows, MySQL is still loading and evicting pages underneath.

For operational visibility, commands like these are useful:

sql
SHOW ENGINE INNODB STATUS;
SHOW VARIABLES LIKE 'innodb_buffer_pool_size';

They do not print every page directly, but they help you reason about page churn, cache efficiency, and storage pressure.

Common Pitfalls

The most common mistake is thinking a page is the same thing as a row. A page contains many records plus metadata, and a single large row may even require overflow storage behavior depending on row format and column types.

Another mistake is assuming every lookup reads exactly one page. Real queries often touch multiple pages because of B-tree traversal, secondary-to-primary lookups, and MVCC bookkeeping.

People also underestimate how page size and index width affect cache efficiency. Wider rows and wider indexes mean fewer entries per page, which can increase I/O for the same logical workload.

Finally, a page is an engine-level concept. The details here are primarily about InnoDB, not every storage engine MySQL has ever supported.

Summary

  • In InnoDB, a page is the basic storage and I/O unit, usually 16KB.
  • Tables and indexes are stored as B-trees built from pages.
  • Clustered index pages hold row data, while secondary index pages hold indexed values plus primary keys.
  • The buffer pool caches pages, not individual rows.
  • Page splits and page width have direct performance consequences.
  • Understanding pages helps explain indexing, caching, and random-vs-sequential write behavior.

Related reading
Course
Beginner
27 lessons
10 hours
System Design Fundamentals

Build a strong foundation in designing scalable, reliable distributed systems.

View the course
Track what you have practised

A free account saves your progress, solutions and study plan across every problem on Codemia.

System Design practice on Codemia

Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.

Practice system design

All Rights Reserved.