Skip to content

Commit 781f14c

Browse files
committed
ACP2E-2033: [Performance issue] Price indexer works slow
- added indexer hint
1 parent 310d37d commit 781f14c

File tree

1 file changed

+4
-2
lines changed
  • app/code/Magento/Bundle/Model/ResourceModel/Indexer

1 file changed

+4
-2
lines changed

app/code/Magento/Bundle/Model/ResourceModel/Indexer/Price.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -708,13 +708,15 @@ private function calculateDynamicBundleSelectionPrice(array $dimensions): void
708708
'IF(i.tier_percent IS NOT NULL, ROUND((1 - i.tier_percent / 100) * idx.min_price * bs.selection_qty, 4),
709709
NULL) AS `tier_price`'
710710
];
711+
$metadata = $this->metadataPool->getMetadata(ProductInterface::class);
712+
$linkField = $metadata->getLinkField();
711713
$selectFrom = [
712714
'`' . $this->getBundlePriceTable() . '` AS `i`',
713715
'INNER JOIN `' . $this->getTable('catalog_product_entity') .
714716
'` AS `parent_product` ON parent_product.entity_id = i.entity_id AND
715717
(parent_product.created_in <= 1 AND parent_product.updated_in > 1)',
716718
'INNER JOIN `' . $this->getTable('catalog_product_bundle_option') . '` AS `bo`
717-
ON bo.parent_id = parent_product.row_id',
719+
ON bo.parent_id = parent_product.' . $linkField,
718720
'INNER JOIN `' . $this->getTable('catalog_product_bundle_selection') . '` AS `bs`
719721
ON bs.option_id = bo.option_id',
720722
'INNER JOIN `' . $this->getMainTable($dimensions) . '` AS `idx` USE INDEX (PRIMARY)
@@ -738,7 +740,7 @@ private function calculateDynamicBundleSelectionPrice(array $dimensions): void
738740
implode(" AND ", $selectWhere)
739741
);
740742
$connection->query(sprintf(
741-
"INSERT INTO `catalog_product_index_price_bundle_sel_temp` (%s) %s ON DUPLICATE KEY UPDATE %s",
743+
"INSERT INTO `" . $this->getBundleSelectionTable() . "` (%s) %s ON DUPLICATE KEY UPDATE %s",
742744
implode(",", $insertColumns),
743745
$select,
744746
implode(",", $updateValues)

0 commit comments

Comments
 (0)