Merge pull request #45058 from nextcloud/perf/db/sort-before-chunking

perf(db): Sort data for IN before chunking
artonge/fix/listen_to_group_removal_for_share
Christoph Wurst 4 weeks ago committed by GitHub
commit 6258823aba
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -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