I'm using Magento 2.4.6, I want optimize the database, Some tables have large entries.


What is the use of these tables?

Can I truncate these tables from live site?

1 Answer 1


Yes, to truncate the report_viewed_product_aggregated_daily, report_viewed_product_aggregated_monthly, report_viewed_product_aggregated_yearly, and report_viewed_product_index tables in Magento 2. However, you should exercise caution when doing so, as truncating these tables will remove all historical data related to viewed products, and you won't be able to recover the data. You must take backup of these tables then you can start truncating on it.

The purpose of these tables are given below :

  • report_viewed_product_aggregated_daily: This table stores aggregated data on the daily views of products. It contains pre-calculated data for various attributes like product IDs, store IDs, view counts, and timestamps. Aggregated data is stored on a daily basis, allowing you to see trends in product views over time.

  • report_viewed_product_aggregated_yearly: Just like the previous two tables, this one stores aggregated data as well, but on a yearly basis. It gives you an even broader perspective of product views over the course of a year.

  • report_viewed_product_aggregated_monthly: Similar to the daily table, this table stores aggregated data, but on a monthly basis. It provides a higher-level overview of product views for each month.

  • report_viewed_product_index: This table contains the actual individual records of product views. It stores data on every view event, including details like customer ID, product ID, store ID, and timestamp. This table forms the basis for populating the aggregated tables mentioned above. Please let us know if you have any other query.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.