1

I have question. When I delete all record from table: catalog_category_product_index

and then run command:

php bin/magento indexer:reindex catalog_category_product catalog_product_category

will all product IDs be changed after this operation, or will IDs remain the same?

1 Answer 1

1

catalog_category_product_index is an index table. In Magento, index tables are generated from the content of other tables.

The product id in this table refers to products in the table catalog_product_entity (row_id and entity_id, most likely the same).

If you reindex with the command you mention, and no changes have been made to any products or categories since the last reindex, the product ids will be exactly the same.

Otherwise:

  • All products that have not been deleted since the last reindex will have the same product id in this table.
  • If you have added products since the last reindex, this table will have more rows, with new product ids.
  • If you have deleted products since the last reindex, this table will have less rows - these product ids will be missing.
  • If you have deleted and re-created products since the last reindex, you will not find the product ids of the deleted products anymore, but new product ids instead.

In most cases, I would say, in the day-to-day business, the product ids will remain the same.

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.