If you ever managed a medium to large Magento shop you very well know that its database size can grow quite a bit. In particular if the site has sizable catalog, large amount of traffic, and a nice number of daily orders. All of that translates to large increases in DB size.
What is not well understood is that Magento by default stores a lot of information that is not crucial for its overall operation. By default Magento stores some level of traffic logs, reports, and dataflow export/import information. Most of which is only needed in case one is debugging and troubleshooting certain operations of the eCommerce platform. Here is a small script I often use before I dump (using the command line mysqldump) the entire database:
The way I use it by issuing the following command line:
mysql -u[user] -p[pass] -h[host] [db_name] < clea_magento_logs.sql
In some cases I was able to shrink the size of the DB from 1GB down to a 100M-200M in size. I hope you will find it useful.
TIP: you can save yourself additional space and repetitive cleaning by commenting out the observers that actually add the log information to the DB.