How to reset dashboard data in magento

When I first started in magento after logging into the dashboard, I saw a bunch of data that didn’t correspond to the real statistics and I wanted to deleted those data, but it was hard and I didn’t know how to do it via the admin area. This is what I had to do via SQL query. The following code was found on the internet and you now know how to do it too:

SET foreign_key_checks = 0;

— Last 5 Search Terms / Top 5 Search Terms

TRUNCATE TABLE catalogsearch_fulltext;

TRUNCATE TABLE catalogsearch_query;

TRUNCATE TABLE catalogsearch_result;

— Dashboard stats (e.g. “Most Viewed Products” etc)

TRUNCATE TABLE report_compared_product_index;

TRUNCATE TABLE report_event;

TRUNCATE TABLE report_viewed_product_aggregated_daily;

TRUNCATE TABLE report_viewed_product_aggregated_monthly;

TRUNCATE TABLE report_viewed_product_aggregated_yearly;

TRUNCATE TABLE report_viewed_product_index;

— Bestsellers

TRUNCATE TABLE sales_bestsellers_aggregated_daily;

TRUNCATE TABLE sales_bestsellers_aggregated_monthly;

TRUNCATE TABLE sales_bestsellers_aggregated_yearly;

SET foreign_key_checks = 1;

Reference:https://gist.github.com/mystix/5360885

September 27, 2016, 8:23 am