Mysql 5.5 Defragmentation not reducing the fragmentation percent

fragmentationinnodbMySQLoptimizationsql

We are running OPTIMIZE TABLE , but not seeing any fragmentation reduction. They are as high as 120% to 200%.

Am calculating the fragmentation % using this: Data_Free / (Data_Length + Index_Length)

My tables are using INNODB engine and "innodb_file_per_table" set to 1.

What am I missing?

Has something change with Mysql 5.5+ onwards?

TIA

Best Answer

"OPTIMIZE TABLE" is only for MyISAM tables - InnoDB doesn't suffer from 'fragmentation' like MyISAM tables. Therefore, you don't need to optimize them.

Additionally, your calculation method is incorrect. As there's more going on than just data+index length.