Created
October 20, 2014 18:09
-
-
Save quentindemetz/ea2ec1a09f71134d0b5f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mysql -u $user -p$password -h $host -NBe "SHOW TABLE STATUS;" $db | while read name engine version rowformat rows avgrowlength datalength maxdatalength indexlength datafree autoincrement createtime updatetime checktime collation checksum createoptions comment ; do | |
if [ "$datafree" -gt 0 ] ; then | |
fragmentation=$(($datafree * 100 / $datalength)) | |
echo "$database.$name is $fragmentation% fragmented." | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment