Magento’s DB seems to get bloated rather quickly with cached data and logs, occupying an obscene amount of space, so it often needs a good clear out.
Many of those tables can safely be flushed, without affecting the operation of the website.
I’ve read a few articles on which tables are “safe” to empty- while there does seem to be some mixed views/opinions, there is enough common ground to establish some consensus. I’ve stuck to truncating the following tables, and it seems to be the trick (i.e. dramatically increase available disk space):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
TRUNCATE core_cache; TRUNCATE core_cache_option; TRUNCATE core_cache_tag; TRUNCATE core_session; TRUNCATE dataflow_batch_export; TRUNCATE dataflow_batch_import; TRUNCATE enterprise_logging_event; TRUNCATE enterprise_logging_event_changes; TRUNCATE enterprise_support_backup; TRUNCATE enterprise_support_backup_item; TRUNCATE index_event; TRUNCATE index_process_event; 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 report_viewed_product_index;
P.s. some of the tables above may not exist in your DB, so just strip those out.
Learning & sharing
This is where we store some of our Web Development thoughts, tips and tricks for both our own uses and for others to learn from. Sharing is caring.
Please feel free to contribute to our blog posts; perhaps even teach us a few tricks of your own. We'd love to hear your thoughts.