Skip to content

Instantly share code, notes, and snippets.

@pkdavies
Created March 4, 2013 15:07
Show Gist options
  • Save pkdavies/5082859 to your computer and use it in GitHub Desktop.
Save pkdavies/5082859 to your computer and use it in GitHub Desktop.
Cleanup Magento database tables, including old quotes that never made it to checkout
USE magentositedb;
TRUNCATE `magento_dataflow_batch_export`;
TRUNCATE `magento_dataflow_batch_import`;
TRUNCATE `magento_log_customer`;
TRUNCATE `magento_log_quote`;
TRUNCATE `magento_log_summary`;
TRUNCATE `magento_log_summary_type`;
TRUNCATE `magento_log_url`;
TRUNCATE `magento_log_url_info`;
TRUNCATE `magento_log_visitor`;
TRUNCATE `magento_log_visitor_info`;
TRUNCATE `magento_log_visitor_online`;
TRUNCATE `magento_m2e_log`;
TRUNCATE `magento_report_compared_product_index`;
TRUNCATE `magento_report_event`;
TRUNCATE `magento_report_viewed_product_index`;
DELETE FROM `magento_sales_flat_quote` WHERE updated_at < DATE_SUB( Now( ) , INTERVAL 14 DAY );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment