Magento – Is it safe to truncate these tables

magento-1.9

I have Magento 1.9 installed, and have approximately 3,000 products. We've been doing a ton of CSV importing, and I'm getting concerned about the size of the database.

In particular, these 3 tables concern me:

  1. catalog_product_index_price – 442,442 rows
  2. catalog_product_index_price_idx – 442,442 rows
  3. core_url_rewrite – 270,749 rows

I have truncated the core_url_rewrite table in another Magento system, and everything was fine once it reindexed.

But I'm not sure about catalog_product_index_price and catalog_product_price_idx – can I truncate those 2 tables? Will they rebuild themselves after we reindex?

Please advise.

Best Answer

in theory, if you reindex everything after you truncate these tables everything should be OK (but you might lose some custom url rewrites that are not linked to products or categories).

The table catalog_product_index_price_idx will be truncated anyway when the price reindex starts. See here how _idx tables work.

but I bet that if you truncate the catalog_product_index_price and you reindex, you will end up with the same number of rows. If you don't you might have an issue with the foreign keys of your database.

Anyway...before trying to truncate them, you should backup your database.

Related Topic