aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Files/Cache
diff options
context:
space:
mode:
authorChristoph Wurst <ChristophWurst@users.noreply.github.com>2024-05-07 12:11:32 +0200
committerGitHub <noreply@github.com>2024-05-07 12:11:32 +0200
commit6258823abaedf5c4f1c91774e675488ce68fe204 (patch)
treecc425d6f87566bc66947372aa38b25041dcc6d7a /lib/private/Files/Cache
parent0af06f6e381061da5acd02ac6bdee9244ef48c8d (diff)
parentf3d6309e36a29bf2392a8d4b2b269af77ddc3561 (diff)
downloadnextcloud-server-6258823abaedf5c4f1c91774e675488ce68fe204.tar.gz
nextcloud-server-6258823abaedf5c4f1c91774e675488ce68fe204.zip
Merge pull request #45058 from nextcloud/perf/db/sort-before-chunking
perf(db): Sort data for IN before chunking
Diffstat (limited to 'lib/private/Files/Cache')
-rw-r--r--lib/private/Files/Cache/Cache.php3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/private/Files/Cache/Cache.php b/lib/private/Files/Cache/Cache.php
index 62e1e57a171..5267b8a8153 100644
--- a/lib/private/Files/Cache/Cache.php
+++ b/lib/private/Files/Cache/Cache.php
@@ -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();