Magento – Which database tables can be completely rebuilt via Magento’s Reindex All command

databaseindexingreindex

Which tables in Magento could be truncated and completely repopulated using a "reindex all" command?

The reason I ask is that I've been working on a daily automation task that prepares "development-ready" copies of our production database. These backups are intended to be as convenient as possible for developers; part of which is reducing the download size and the time needed to restore a backup from a dump.

Best Answer

This question has been asked before, please see this: https://stackoverflow.com/questions/12205714/list-of-tables-to-safely-truncate-in-magento

This should help you.

EDIT: For posterity sake:

When you log an issue with Magento support and they ask you to provide a database dump, the script they give you dumps the schema only for the following tables:

core_cache
core_cache_option
core_cache_tag
log_customer
log_quote
log_summary
log_summary_type
log_url
log_url_info
log_visitor
log_visitor_info
log_visitor_online
enterprise_logging_event
enterprise_logging_event_changes
index_event
index_process_event
report_event
report_viewed_product_index
dataflow_batch_export
dataflow_batch_import

If Magento support doesn't need the contents of these tables to resolve issues, it would be a safe assumption that they can be safely truncated.

The catalog_product_flat_* tables and catalog_category_flat_* tables can also be truncated as a reindex will re-populate them.

A user can add entries to the core_url_rewrite table manually from the back end and I wouldn't like to guarantee that two products pr categories with identical URL keys will always have the same URLs after truncating core_url_rewrite. It's not one I'd rely on being able to truncate safely.

Source - Jim OHalloran

Related Topic