Course contentsShow
← Databases & SQL
Lesson 990 of 1,9539. MySQL and MariaDB EcosystemsFree lesson

Configuring InnoDB Page Size

Evaluate the impact of page size adjustments on row density and I/O throughput.

In this lesson, you will learn how adjusting the InnoDB page size balances row density and I/O efficiency to optimize your database’s performance.

Understanding InnoDB Page Size

By default, InnoDB stores data in 16KB pages. This is the smallest unit of transfer between disk storage and the memory buffer pool. While 16KB is a reliable "middle ground," you can configure this to be 4KB, 8KB, 32KB, or 64KB (depending on your specific MySQL/MariaDB version).

The Impact on Row Density

Row density refers to how many records can fit into a single page. If you use a smaller page size (e.g., 4KB), you reduce the amount of data transferred in a single I/O operation. This is beneficial for high-concurrency workloads with small rows, as it reduces "internal fragmentation"—the wasted space left over when a row doesn't perfectly divide into the page size.

Conversely, a larger page size (e.g., 32KB or 64KB) increases row density. This is excellent for workloads involving large blobs or wide tables, as it reduces the depth of the B-tree index. A shallower tree means fewer "hops" are required to locate a specific record, which can speed up index lookups.

I/O Throughput Considerations

The trade-off for throughput is significant:

  • Large Pages: Reading a large page from disk takes longer, but it pulls more "related" data into the buffer pool at once. If your access pattern is sequential, large pages can significantly improve throughput by reducing the number of total read operations.
  • Small Pages: If your workload is highly random (e.g., many point lookups), smaller pages are often more efficient. Because InnoDB reads the entire page into the buffer pool even if you only need one row, a large page could end up wasting memory by caching unnecessary data.

To check your current configuration, you can query:

SHOW GLOBAL VARIABLES LIKE 'innodb_page_size';

Note that this setting is defined at initialization and cannot be changed on an existing data directory. Choose wisely based on your storage latency and the typical size of your rows.

Key Takeaway: Smaller pages improve random I/O and reduce memory waste for small rows, while larger pages decrease B-tree depth and improve throughput for sequential scans and large record sets.