2

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.

2

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

  • Thanks Daniel, I actually just found that question as well and am reviewing it. It is slightly different, as it also deletes log tables, which reindexing will not regenerate. – STW Mar 5 '14 at 16:08
  • No problem, for the most part, if you're pulling a Production DB into a Dev environment, it would be be a good idea to clear those as well. Unless you're looking for something specifically in those tables (trying to debug an issue), I would recommend clearing them as they tend to get quite large. The information in them will be regenerated as Magento runs in the environment. The log tables in Magento function similarly to the system.log file. – Daniel Kenney Mar 5 '14 at 16:12
  • I agree and actually build two versions--one with logs, and one without. Typically individual developers prefer the smaller/faster log-free version, while we use the logs-included version for reloading our development server. The logs-included version is also occasionally useful for getting historical perspective when looking for difficult or vaguely-described bugs. – STW Mar 5 '14 at 16:18
  • A link-only answer is not the best answer. Consider copying some of the content (quote it and attribute source) into this question for posterity. – philwinkle Mar 5 '14 at 16:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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