Massive 10GB Magento Database

This is a classic, a venerable magento database was presented to me today – it had grown over time to 10GB and was in danger of being booted right off its hosting due to its wide girth!  I’d say cron hadn’t been run for years.

Anyway its very easy to clean up the magento database, most of the data bloat is stored in a group of log tables and can be just delete right away by running the following queries on the DB:

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;

This reduced the DB size from 10GB to about 150MB.