How to Optimize your Magento Database

Updated on Mar 8, 2019

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:


Clean Log Tables


Clean Old Cache and Log Files

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 Create CronJobs. The exact command should be:

curl -s -o /dev/null
curl -s -o /dev/null
On this page...

    Magento Hosting

    • Free Installation
    • 24/7 Magento Support
    • Hack-free Protection
    • Fast SSD Storage
    • Free Domain Transfer
    • Free Magento Transfer
    • Immediate Activation
    • Free Cloudflare CDN
    View More