5

Could someone explain me what is the difference between the indexes catalog_category_product and catalog_product_category?

From db i see that catalog_category_product is related to table catalog_category_product_index, but i don't find to which table is related catalog_product_category index.

  • There is no catalog_product_category table in Magento 2.1.5 CE & catalog_category_product stores Category wise Product Info – Ankit Shah Mar 22 '17 at 8:12
  • Yes i see that, so what is the role of catalog_product_category index? – LucScu Mar 22 '17 at 8:44
  • There is no catalog_product_category Index table as well – Ankit Shah Mar 22 '17 at 8:51
  • @AnkitShah I think my question is clear and you continue to give useless reply. What is the role of catalog_product_category index if it isn't related to any table? What does this index when run? – LucScu Mar 22 '17 at 9:05
  • @AnkitShah Do you give vote down? Are you serious? – LucScu Mar 23 '17 at 7:46
1

Looking deep in magento core files, you notice that catalog_product_category index model is Magento\Catalog\Model\Indexer\Product\Category that extends Magento\Catalog\Model\Indexer\Category\Product that is the model of catalog_category_product index.

Both of them $fullActionFactory and $rowsActionFactory entities extends from Magento\Catalog\Model\Indexer\Category\Product\AbstractAction that has

const MAIN_INDEX_TABLE = 'catalog_category_product_index';

So we can say that both indexer works and save data on the same table catalog_category_product_index.

1

catalog_product_category : the "true" data saved by product. Those are the categories checked in the back-office when you edit the product.

catalog_product_category_index : where the product are "really". Meaning, if the parent category has "is_anchor" at yes, it means it has also the children category in it. So, it's "normal" to have both of those table.

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.