Skip to content

Commit 5766aa8

Browse files
committed
ACP2E-2204: Price indexing performance gradually degrades overtime
- trying to drop tables instead
1 parent 148a658 commit 5766aa8

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

app/code/Magento/Catalog/Model/Indexer/Product/Price/Action/Full.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,12 @@ private function reindexByBatches(
259259
array $dimensions,
260260
string $typeId
261261
): void {
262+
$i = 0;
262263
foreach ($this->getBatchesForIndexer($typeId) as $batch) {
264+
$start = microtime(true);
263265
$this->reindexByBatchWithDimensions($priceIndexer, $batch, $dimensions);
266+
$time_elapsed_secs = microtime(true) - $start;
267+
echo $i++."--> $time_elapsed_secs secs".PHP_EOL;
264268
}
265269
}
266270

@@ -311,7 +315,6 @@ private function reindexByBatchWithDimensions(
311315
if (!empty($entityIds)) {
312316
$this->dimensionTableMaintainer->createMainTmpTable($dimensions);
313317
$temporaryTable = $this->dimensionTableMaintainer->getMainTmpTable($dimensions);
314-
315318
$priceIndexer->executeByDimensions($dimensions, \SplFixedArray::fromArray($entityIds, false));
316319

317320
// Sync data from temp table to index table
@@ -488,6 +491,7 @@ private function moveDataFromReplicaTableToReplicaTables(array $dimensions): voi
488491
* Retrieves the index table that should be used
489492
*
490493
* @deprecated 102.0.6
494+
* @see only used in another deprecated method: _copyRelationIndexData
491495
*/
492496
protected function getIndexTargetTable(): string
493497
{

app/code/Magento/Catalog/Test/Unit/Model/Indexer/Product/Price/CustomOptionPriceModifierTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,8 @@ public function testModifyPrice(): void
9292
$connection->expects($this->exactly(2))->method('delete');
9393
$connection->expects($this->any())->method('select')->willReturn($select);
9494
$connection->expects($this->any())->method('fetchRow')->willReturn(['exists']);
95-
$connection->expects($this->exactly(6))->method('query');
95+
$connection->expects($this->exactly(4))->method('query');
96+
$connection->expects($this->exactly(2))->method('dropTemporaryTable');
9697
$this->resource->expects($this->any())->method('getConnection')->willReturn($connection);
9798
$this->resource->expects($this->any())->method('getTableName')->willReturn('table');
9899
$this->tableStrategy->expects($this->any())

0 commit comments

Comments
 (0)