aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2024-04-26 15:38:29 +0200
committerChristoph Wurst <christoph@winzerhof-wurst.at>2024-04-26 15:38:29 +0200
commitf3d6309e36a29bf2392a8d4b2b269af77ddc3561 (patch)
tree158462686e83a45d1115dc79ddc2e59a24551661 /lib
parent10af08736e9094dd3f7240ec517cea9a0061d5b4 (diff)
downloadnextcloud-server-f3d6309e36a29bf2392a8d4b2b269af77ddc3561.tar.gz
nextcloud-server-f3d6309e36a29bf2392a8d4b2b269af77ddc3561.zip
perf(db): Sort data for IN before chunking
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'lib')
-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();