Clearing Magento 1 log tables

      No Comments on Clearing Magento 1 log tables

Like all software, Magento 1 likes to log a lot of actions. That is usually useful information and not a problem, but it can make for a larger database that you would like. Especially if you need to copy the site to a new server or a local development environment. Honestly, in my experience, I have rarely had to refer to these logs.

For that reason, I have a way to clear out the log tables for smaller file transport.

There are three ways to do this:
1. When logged into the admin, go to “System -> Configuration -> Advanced -> System -> Log. Set the log clean time down to a small number. By default on the sites I manage, it’s 180 days. Something like one or two days would keep the tables pretty small.
2. Go straight to the database and truncate all of the log tables. Below is the sql code that is tested and approved for this measure.
[code]
TRUNCATE dataflow_batch_export;
TRUNCATE dataflow_batch_import;
TRUNCATE log_customer;
TRUNCATE log_quote;
TRUNCATE log_summary;
TRUNCATE log_summary_type;
TRUNCATE log_url;
TRUNCATE log_url_info;
TRUNCATE log_visitor;
TRUNCATE log_visitor_info;
TRUNCATE log_visitor_online;
TRUNCATE report_viewed_product_index;
TRUNCATE report_compared_product_index;
TRUNCATE report_event;
TRUNCATE index_event;
[/code]

Keep your log tables clean for site transport.

Leave a Reply

Your email address will not be published. Required fields are marked *