Skip to content

Commit b226039

Browse files
ChristophWurstjoshtrichards
authored andcommitted
perf(db): Sort data for IN before chunking
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
1 parent b127e02 commit b226039

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
@@ -629,6 +629,9 @@ private function removeChildren(ICacheEntry $entry) {
629629
$query->delete('filecache')
630630
->whereParentInParameter('parentIds');
631631

632+
// Sorting before chunking allows the db to find the entries close to each
633+
// other in the index
634+
sort($parentIds, SORT_NUMERIC);
632635
foreach (array_chunk($parentIds, 1000) as $parentIdChunk) {
633636
$query->setParameter('parentIds', $parentIdChunk, IQueryBuilder::PARAM_INT_ARRAY);
634637
$query->execute();

0 commit comments

Comments
 (0)