cancel
Showing results for 
Search instead for 
Did you mean: 

Which log-tables can be truncated without deleting magento-reports?

Which log-tables can be truncated without deleting magento-reports?

Hi there,

 

i have to truncate the logfile-tables in order to clean up the database

There are several google-hits if you search for the right tables. This is what i got:

 

TRUNCATE dataflow_batch_export;
TRUNCATE dataflow_batch_import;
TRUNCATE log_customer;
TRUNCATE log_quote;
TRUNCATE log_summary;
TRUNCATE log_summary_type;
TRUNCATE log_url;
TRUNCATE log_url_info;
TRUNCATE log_visitor;
TRUNCATE log_visitor_info;
TRUNCATE log_visitor_online;
TRUNCATE report_viewed_product_index;
TRUNCATE report_compared_product_index;
TRUNCATE report_event;
TRUNCATE index_event;
TRUNCATE catalog_compare_item;

 

 

Unfortunately it is important that the data for magento-reports wont be removed. Which tables (except the report_ ... ones of course) can i truncate without clearing magento-reports?

 

thanks for your help in advance Smiley Happy

3 REPLIES 3

Re: Which log-tables can be truncated without deleting magento-reports?

@pbecker

Run these quaries and it will truncate the logfile tables excluding Magento Reports.

SET foreign_key_checks = 0;
TRUNCATE dataflow_batch_export;
TRUNCATE dataflow_batch_import;
TRUNCATE log_customer;
TRUNCATE log_quote;
TRUNCATE log_summary;
TRUNCATE log_summary_type;
TRUNCATE log_url;
TRUNCATE log_url_info;
TRUNCATE log_visitor;
TRUNCATE log_visitor_info;
TRUNCATE log_visitor_online;
TRUNCATE index_event;
TRUNCATE catalog_compare_item;
SET foreign_key_checks = 1;
Was my answer helpful? You can accept it as a solution.
200+ Premium Magento 2 Extensions Need help? Hire Magento Developer

Re: Which log-tables can be truncated without deleting magento-reports?

thx for your answer. So you are sure that only the report_ tables are responsible for the magento-reports? 

There are no foreign-key connections to other tables, the report_ tables need for consistency?

 

 

Re: Which log-tables can be truncated without deleting magento-reports?

@pbecker

 

 

Yes, I'm sure. Check the image below. These reports will not be deleted if you that's what you want.

Was my answer helpful? You can accept it as a solution.
200+ Premium Magento 2 Extensions Need help? Hire Magento Developer