cancel
Showing results for 
Search instead for 
Did you mean: 

Magento\Catalog\Model\Indexer\Product\Flat\Action\Eraser::removeDisabledProducts bug?

Magento\Catalog\Model\Indexer\Product\Flat\Action\Eraser::removeDisabledProducts bug?

Hello all.

Subject's method contains next code:

        $select->joinLeft(
            ['status_global_attr' => $statusAttribute->getBackendTable()],
            ' status_global_attr.attribute_id = ' . (int)$statusAttribute->getAttributeId()
            . ' AND status_global_attr.store_id = ' . Store::DEFAULT_STORE_ID,
            []
        );
        $select->joinLeft(
            ['status_attr' => $statusAttribute->getBackendTable()],
            ' status_attr.attribute_id = ' . (int)$statusAttribute->getAttributeId()
            . ' AND status_attr.store_id = ' . $storeId,
            []
        );

This code generate SQL query like this:

SELECT `product_table`.*, `product_table`.`entity_id` 
FROM `catalog_product_entity` AS `product_table`
 LEFT JOIN `catalog_product_entity_int` AS `status_global_attr` ON  status_global_attr.attribute_id = 97 AND status_global_attr.store_id = 0
 LEFT JOIN `catalog_product_entity_int` AS `status_attr` ON  status_attr.attribute_id = 97 AND status_attr.store_id = 2 WHERE (product_table.entity_id IN('1876784')) AND (IFNULL(status_attr.value, status_global_attr.value) = 2);
It slows magento very much. Must be:
...
LEFT JOIN `catalog_product_entity_int` AS `status_global_attr` ON PRODUCT_TABLE.ENTITY_ID = STATUS_GLOBAL_ATTR.ENTITY_ID AND status_global_attr.attribute_id = 97 AND status_global_attr.store_id = 0
LEFT JOIN `catalog_product_entity_int` AS `status_attr` ON PRODUCT_TABLE.ENTITY_ID = STATUS_ATTR.ENTITY_ID AND status_attr.attribute_id = 97 AND status_attr.store_id = 2 WHERE (product_table.entity_id IN('1876784')) AND (IFNULL(status_attr.value, status_global_attr.value) = 2);

Is it bug? Or feature?

1 REPLY 1

Re: Magento\Catalog\Model\Indexer\Product\Flat\Action\Eraser::removeDisabledProducts bug?

Did you even find a solution to this? I am having the same problem though the query is loading gigabytes of data and causing the php process to run out of memory, causing the save to fail.