Why MySQL 8.0 Table Rebuilds Slow Down and How to Fix It
MySQL 8.0 (especially versions 8.0.20+) suffers a performance regression in table‑rebuilding operations like ALTER TABLE … FORCE, running up to three times slower than 5.7 due to the default innodb_doublewrite_pages setting, but the issue can be mitigated by adjusting the parameter or upgrading to 8.4+.
MySQL 8.0 has a performance regression mainly manifested in table‑rebuilding operations whose execution efficiency drops significantly.
Core Issue
In MySQL 8.0 (especially 8.0.20 and later), executing ALTER TABLE ... FORCE and similar table‑rebuilding commands performs more than three times slower than in version 5.7. The problem was confirmed in July 2024 to be caused by an improper default value of the innodb_doublewrite_pages parameter.
Root Cause
Parameter change introduced a defect MySQL 8.0.20 introduced the innodb_doublewrite_pages parameter (default 4), which controls the number of pages written in each batch of InnoDB double‑write. The low value leads to:
I/O operations become more frequent
Double‑write buffer flush efficiency decreases
Disk sync cost rises significantly
Historical behavior difference In MySQL 5.7 the parameter did not formally exist, but its underlying implementation behaved as if the default were 128, resulting in higher I/O efficiency for table‑rebuilding.
Documentation and fix delay Although MySQL 8.4.0 corrected the default to 128, the 8.0 series retained the original default for LTS stability, requiring users to adjust the setting manually.
Affected Scenarios
The issue is especially noticeable in the following operations:
Using the INPLACE algorithm to rebuild tables (e.g., ALTER TABLE ... FORCE)
DDL operations involving massive data‑page writes
High‑concurrency write scenarios where double‑write buffer contention occurs
Official Recommendations
Temporary workaround : Set innodb_doublewrite_pages to 128 (requires instance restart)
Long‑term solution : Upgrade to MySQL 8.4+
Monitoring advice : Watch the Innodb_dblwr_pages_written and Innodb_dblwr_writes metrics for changes
(Note: the issue was fixed in MySQL 8.4 by adjusting the default value, but as of April 2025 MySQL 8.0 still retains the original default.)
Reference: https://jfg-mysql.blogspot.com/2025/04/performance-regression-in-mysql-80-fixed-in-84-easy-workaround.html
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Aikesheng Open Source Community
The Aikesheng Open Source Community provides stable, enterprise‑grade MySQL open‑source tools and services, releases a premium open‑source component each year (1024), and continuously operates and maintains them.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
