Cleaning big Magento databases
First at all, Magento system has a built-in for cleaning up log information.
If you go to
System > Configuration > Advanced > System > Log Cleaning
You can configure your store to automatically clean up these logs.
But if you have already a very big database, the best option is cleaning the big tables. To do that try these SQL queries:
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;
There is another table that can be excessively large, it is core_url_rewrite and it seems that it's not a good idea to delete its values for SEO reasons. You can find more information about it here
In this tutorial you can find a really easy script to clean Magento database and cache files Magneto Log & Cache Maintenance Script