Shrinking Database Size for Magento


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:

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.

Want to Chat with Experienced Magento Developers? Contact Us Now →