A Script to Optimize Fragmented Tables in MySQL
I wrote a BASH script that will run “optimize table” on any table fragmented. it’s pretty tidy, and you can supply usernames and passwords, and even run it against remote MySQL databases.
Here’s an example of it’s output:
root@lit [~]# mysqlFragFinder
MySQL fragmentation finder (and fixer) v0.7.2, written by Phil Dufault ( http://www.dufault.info/ )
Found 59 databases
Checking someforum_forum … found 1 fragmented table.
Optimizing log_online … done
Checking dufault_blog … found 2 fragmented tables.
Optimizing wp_comments … done
Optimizing wp_options … done
3 tables were fragmented, and were optimized.
I find this a great script — maybe a feature to add later is a way to prevent it from optimizing really large tables.
Here’s a link to the source:
mysqlFragFinder
Any other features you’d like to see in it? Comment!





1 Comment
[...] FreshersHome.com | Freshers Jobs, Walk-in For Freshers, Jobs in India, Bangalore, Chennai, Delhi Mum… wrote an interesting post today onHere’s a quick excerptI wrote a BASH script that will run “optimize table” on any table fragmented. it’s pretty tidy, and you can supply usernames and passwords, and even run it against remote MySQL databases. Here’s an example of it’s output: root@lit [~]# mysqlFragFinder MySQL fragmentation finder (and fixer) v0.7.2, written by Phil Dufault ( http://www.dufault.info/ ) Found 59 databases Checking someforum_forum … […] [...]