Skip to content

Commit 1119260

Browse files
authored
Ensure deleted index data is integer IDs
With a very large product set (~213k) on 1 of our sites, the price index (and through the use of MSI, the inventory index) takes a very long time to complete, with multiple hours spent executing deleteIndexData. It seems the primary cause of this slowdown is string to int conversions or vice versa in MySQL, and ensuring that all IDs are integers beforehand yields much more consistent and reasonable performance on these larger sets
1 parent c60f4cf commit 1119260

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

app/code/Magento/Catalog/Model/Indexer/Product/Price/AbstractAction.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,7 @@ protected function _reindexRows($changedIds = [])
429429
*/
430430
private function deleteIndexData(array $entityIds)
431431
{
432+
$entityIds = array_unique(array_map('intval', $entityIds));
432433
foreach ($this->dimensionCollectionFactory->create() as $dimensions) {
433434
$select = $this->getConnection()->select()->from(
434435
['index_price' => $this->tableMaintainer->getMainTableByDimensions($dimensions)],

0 commit comments

Comments
 (0)