Database Maintenance: Trim the fat off of DB by truncating log tables

Submitted by metaharper - 5 years ago

These tables can be safely truncated as they are meant to store either log or temporary data. I've reduced a 4GB MySQL dump down to 1GB before just by running this. If you are running MySQL Workbench or other GUI, you may be required to precede your SQL commands with SET SQL_SAFE_UPDATES = 0;. Remember to revert that afterwords with SET SQL_SAFE_UPDATES = 1;.

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_event; 
TRUNCATE catalogsearch_fulltext; 
TRUNCATE catalogsearch_query; 
TRUNCATE catalog_compare_item; 
Learn PHP
comments powered by Disqus
Proudly hosted on Digital Ocean