WordPress Database Cleanup HOWTO
To understand how to clean up a WordPress Database, one must understand how the physical data is stored on the cloud or on a web hosting server. Imagine a 12″ vinyl record. All tracks spin towards the center of the disk. Each track contains a song. How many words are in that song? Now a storage device will know that several of those songs are scattered all over random locations on the record. While the needle spins back and fourth seeking out all tiny blocks that make up the entire bits and bytes you asked it to retrieve.
Along came Database Optimization for MySQL
MySQL Server will examine the data and rewrite it on the 12″ Vinyl Record so there are no gaps between songs and the song is not scattered in bits n pieces. This optimization should be running once per day on your WordPress blog site. I’ve omitted credential information necessary to run the code. It relies on the cPanelâ„¢ method of one MySQL user which is the same name as the FTP user would control all the databases within the account.
Setup a CRON job either through cPanel or directly if you have elevated access or visit http://www.thepcmanwebsite.com/crontab_generator.shtml:
php -q /home/xxxxxxx/db-optimization.php