perf(db): Sort data for IN before chunking

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
backport/45058/stable27
Christoph Wurst 3 weeks ago committed by backportbot[bot]
parent 9f7d57494b
commit c95a0ca193

@ -629,6 +629,9 @@ class Cache implements ICache {
$query->delete('filecache')
->whereParentInParameter('parentIds');
// Sorting before chunking allows the db to find the entries close to each
// other in the index
sort($parentIds, SORT_NUMERIC);
foreach (array_chunk($parentIds, 1000) as $parentIdChunk) {
$query->setParameter('parentIds', $parentIdChunk, IQueryBuilder::PARAM_INT_ARRAY);
$query->execute();

Loading…
Cancel
Save