Tag Archives: Logs

Cleaning Magento Store’s Database logs for faster performance

23 Aug

As we all know magento is a highly scalable eCommerce system but its database is not as efficient as it should be.It contains log tables and cleaning logs at regular interval will reduce latency of query execution which in turns helps in improving the performance of a system. Magento Store performance depends on various parameters but today we will talk about how to clean the log tables.

magento-log-cleaning

**Click Here to View Larger Image

I strongly recommends you to backup your database before doing anything (as it is always safe to have a backup). There are various techniques to take a back up your database.

  • Free extensions available to on maze store to take the backup.
  • You can use Magento’s built in profilers to export entire database.
  • Use phpmyadmin to take a backup.

Once you are done with the backup of database. you can use these two different options to clean up your logs:

  • Clean your logs via Magento Admin Panel “Log Cleaning”.
  • Clean up your database tables directly via phpmyadmin or through commandline.

Below are the tables used by Magento to manage logs:-

        log_customer
log_visitor
log_visitor_info
log_url
log_url_info
log_quote
report_viewed_product_index
report_compared_product_index
report_event
catalog_compare_item

How to clean logs via Magento Admin:-

  1. Log on to your Magento Admin Panel.
  2. Go to System => Configuration
  3. On the left side under Advanced click on System (Advanced = > System)
  4. Under system you will see “Log Cleaning” option
  5. Fill the desired “Log Cleaning” option values and click Save.

How to clean the logs through Command line or through phpmyadmin:-

  1. Open the database you are using for your store.
  2. Open the tables as stated above and truncate them.

Note:– Truncate means you are only deleting the values from the tables. Structure remains same. Never drop any table.

You are all done. You can also write a script to truncate the values of this tables on regular interval by putting it in cron. I will explain that in my next post.

Happy Reading and leave you valuable feedback.

Advertisements