perf(db): Sort data for IN before chunking

Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
pull/45058/head
Christoph Wurst 3 weeks ago
parent 10af08736e
commit f3d6309e36
No known key found for this signature in database
GPG Key ID: CC42AC2A7F0E56D8

@ -620,6 +620,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