Skip to content

Commit 935565e

Browse files
ChristophWurstbackportbot[bot]
authored andcommitted
perf(db): Sort data for IN before chunking
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
1 parent 46db517 commit 935565e

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

lib/private/Files/Cache/Cache.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -623,6 +623,9 @@ private function removeChildren(ICacheEntry $entry) {
623623
$query->delete('filecache')
624624
->whereParentInParameter('parentIds');
625625

626+
// Sorting before chunking allows the db to find the entries close to each
627+
// other in the index
628+
sort($parentIds, SORT_NUMERIC);
626629
foreach (array_chunk($parentIds, 1000) as $parentIdChunk) {
627630
$query->setParameter('parentIds', $parentIdChunk, IQueryBuilder::PARAM_INT_ARRAY);
628631
$query->execute();

0 commit comments

Comments
 (0)