How to Optimize your Magento Database

Maintain and cleanold database records for your Magento based Store

Maintain and cleaning your old Magento Cache and Log records can greatly improve your Magento Database performance. Very often Magento database grows big in size due to large log tables and it might be a good idea to regularly perform a maintenance clean up.


To achieve this you can create a small script to be executed on regular bases. The exact script code can be found here


To Optimize your Magento Database, you need to:

Step 1 Clean Log Tables























Step 2 Clean Old Cache and Log Filess

The second option clean old logs and cache files as well as pearlib downloads and cache in the following directories:












To perform the any of the above tasks simply create a file called cleanup.php in your Magento home directory via FTP or your cPanel -> File Manager. You can copy the content of the file from this example.


When you have the file placed in your Magento folder with the copied contend you will need to access the file via:         --clean log tables         --clean cache files


Remember to change "" with your actual domain name.


If you would like to have this executed on regular bases you may set a cron job via your cPanel -> CronJobs following our cPanel Tutorial on How to Setup a CronJob. The exact command should be:


curl -s -o /dev/null
curl -s -o /dev/null