Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQL defragment InnoDB tables

After running mysqltuner, I received this output:

Total fragmented tables: 284

To defragment I tried these:

1. ALTER TABLE tbl_name ENGINE=INNODB
2. Another way to perform a defragmentation operation is to use mysqldump to dump the table to a text file, drop the table, and reload it from the dump file.

Both of the methods are described in MySQL documentation.

But none of the methods helped. Mysqltuner still says that tables are fragmented.

Note: innodb_file_per_table is OFF in my configurations.

How can I defragment my InnoDB tables?

like image 384
torayeff Avatar asked Feb 01 '26 22:02

torayeff


1 Answers

ALTER TABLE tbl_name ENGINE=INNODB

Is the only way to defragment a innodb table.

ALGORITHM=INPLACE can help us to do it online.

like image 91
jmrenouard Avatar answered Feb 04 '26 13:02

jmrenouard



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!