Where the open source database community meets: Use code PERCONA75 and secure your spot for Percona Live.  Register

Pretty-formatted index fragmentation with xtrabackup

March 16, 2011
Author
Baron Schwartz
Share this Post:

The xtrabackup compiled C binary (as distinct from XtraBackup, which is the combination of the C binary and the Perl script) has support for printing out stats on InnoDB tables and indexes. This can be useful to examine whether you’d benefit from “defragmenting” your MySQL database with OPTIMIZE TABLE, although I have not determined firm guidelines for when that will actually help. I’ve written a small Perl script that formats the stats output nicely to give an overview of fragmentation.

It’s an initial draft, and if you find issues with it I would like to know so I can fix them. The script is embedded in the documentation page and can be downloaded by clicking on the header at the top of the code listing. The output looks like this:

That output was generated from the stats output that Vadim showed on an earlier blog post about xtrabackup’s analysis capabilities.

0 0 votes
Article Rating
Subscribe
Notify of
guest

4 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Peter Zaitsev
Admin
15 years ago

Baron,

Just to make it clear does FREE_PAGES lists how many pages are free and PCT_FULL is full ratio of remaining pages, it is not the percent of used pages in the index, right ?

Peter Zaitsev
Admin
15 years ago

Baron,

Just to make it clear does FREE_PAGES lists how many pages are free and PCT_FULL is full ratio of remaining pages, it is not the percent of used pages in the index, right ?

Far
Enough.

Said no pioneer ever.
MySQL, PostgreSQL, InnoDB, MariaDB, MongoDB and Kubernetes are trademarks for their respective owners.
© 2026 Percona All Rights Reserved