July 11, 2025

MySQL 8.0 Performance Regression: Default Parameter Change Causes 3x Slower Table Rebuilds

MySQL 8.0's default innodb_doublewrite_pages setting leads to 3x performance degradation in table rebuilds. Fixes for 8.0.x and upgrade paths to 8.4+ explained.

Background

MySQL 8.0 users have reported significant performance regressions in table rebuild operations (ALTER TABLE ... FORCE) since version 8.0.20. Benchmarks reveal these operations run ​3–5 times slower​ compared to MySQL 5.7, even on identical hardware. The root cause was identified as a flawed default configuration for innodb_doublewrite_pages, introduced in MySQL 8.0.20.

Problem Analysis

The innodb_doublewrite_pages parameter controls how many pages InnoDB flushes to the doublewrite buffer during I/O operations. In MySQL 5.7, this value defaulted to ​128, optimizing throughput by batching writes. However, MySQL 8.0.20+ reset the default to ​4, leading to:

  • Frequent I/O operations: Smaller batches increase disk latency.
  • Reduced buffer efficiency: Doublewrite buffer flushes become bottlenecked.
  • Higher sync costs: Disk synchronization overhead spikes under load.

This change disproportionately impacts operations involving large sequential writes, such as:

  • ALTER TABLE ... FORCE (in-place rebuilds).
  • DDL operations on tables with millions of rows.
  • High-concurrency write workloads.

Historical Context

Prior to MySQL 8.0.20, innodb_doublewrite_pages lacked an explicit default, relying on internal heuristics tied to the buffer pool size. For most deployments, this effectively defaulted to ​128. MySQL 8.0.20+ changed this logic, breaking backward compatibility without adjusting the default.

Affected Scenarios

The regression is most pronounced in:

  1. Table rebuilds: ALTER TABLE ... ENGINE=InnoDB or ALTER TABLE ... FORCE.
  2. Large-scale DDL: Adding indexes to wide tables.
  3. High-write environments: OLTP systems with sustained insert/update rates.

Workarounds and Fixes

Immediate Mitigation (MySQL 8.0.x):

Add the following to your MySQL configuration and restart the instance:

innodb_doublewrite_pages = 128

Monitor performance metrics like Innodb_dblwr_pages_written and Innodb_dblwr_writes to validate improvements.

Long-Term Solution:

Upgrade to ​MySQL 8.4.0 or newer, where the default innodb_doublewrite_pages is restored to ​128.

Key Takeaways

  • Avoid blind upgrades: Test thoroughly when moving to MySQL 8.0 LTS releases.
  • Benchmark custom workloads: Parameter defaults may not align with your use case.
  • Leverage monitoring: Track InnoDB doublewrite activity to preempt regressions.

You will get best features of ChatDBA