MySQL Forums
Forum List  »  InnoDB

Re: Avoid fragmentation for Mysql tables
Posted by: Peter Brawley
Date: August 23, 2017 12:14AM

InnoDB stores data in a tree, reusing space from deletions.

This query estimates fragmentation ...

select engine, table_name,round( data_length/1024/1024) as data_length ,
round(index_length/1024/1024) as index_length,
round(data_free/ 1024/1024) as data_free,
(data_free/(index_length+data_length)) as frag_ratio
from information_schema.tables
where data_free > 0
order by frag_ratio desc;

I don't often see values much over 5%. But see https://www.percona.com/blog/2009/11/05/innodb-look-after-fragmentation/.

How to defragment: https://dev.mysql.com/doc/refman/5.7/en/innodb-file-defragmenting.html

Options: ReplyQuote


Subject
Views
Written By
Posted
1680
August 22, 2017 10:02PM
Re: Avoid fragmentation for Mysql tables
844
August 23, 2017 12:14AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.