Defragment to Recover Space in MYSQL

Posted by
August 24, 2018

If our application is performing a lot of update delete operations on a certain table then there is high possibility that it contains fragmented space.

The OPTIMIZE TABLE statement allows MySQL DBAs to reorganize physical table storage in order to achieve three main goals:

  1. Shrinks the data pages
  2. Shrinks index pages
  3. Computes Fresh Index Statistics
OPTIMIZE TABLE table_name

OPTIMIZE TABLE can be time-consuming depending on the size of the data and indexes. But, running OPTIMIZE TABLE does not harm to the data and indexes get rebuilt.

read more