Magento Site Maintenance

Magento is awesome at many things, but database efficiency is unfortunately not one of those areas – specifically log clearing. I recently did some maintenance on a site that had a 3Gb database — even for a medium-sized site this is quite large. I searched for the log tables & noticed that they were taking up a HUGE chunk of the database. So, I emptied them. After doing this simple task, the database size shot down to 300Mb — that’s a 90% decrease in database size! Now, I’m sure many cases won’t be this dramatic, but if you haven’t setup a cron job to automatically clear these log tables or manually go in & cleared them yourself in awhile, we’d highly recommend you do this ASAP. Below I’m going to show you how to do it. If you don’t feel comfortable doing this yourself, we’ll be more than happy to help you.

If you haven’t done it in a while (or if it’s never been done), we recommend do it manually. Here’s how that’s done:

  1. As always, before you start: make a copy of the database
  2. Log into phpmyadmin
  3. Find your database & open it (if you have more than one)
  4. Look for these tables:
    log_customer
    log_visitor
    log_visitor_info
    log_url
    log_url_info
    log_quote
    report_viewed_product_index
    report_compared_product_index
    report_event catalog_compare_item
    log_summary
    log_summary_type
    log_visitor_online
  5. Select them
  6. At the bottom where it says “With Selected”, select “Empty” (be very, very careful you DON’T select “Dump”!) and then hit “yes”
  7. You’re done!

Check your database size back in cPanel (or whatever control panel you use) & let us know your success stories in the comments below! Happy Magento Maintenancing!

Leave a Reply

Your email address will not be published. Required fields are marked *