aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDaniel <mail@danielkesselberg.de>2024-06-04 12:50:24 +0200
committerGitHub <noreply@github.com>2024-06-04 12:50:24 +0200
commit849587ae2b47393ac3797eb0c242f6cf9533ff4a (patch)
treeb3381bded08a1476b94ed2b6469a7c227caa1251 /lib
parent3c0479dda08032446566b766b7c18b24db38ca1b (diff)
parentb226039fe9c6aab8950165923ffba9d75fafaa74 (diff)
downloadnextcloud-server-849587ae2b47393ac3797eb0c242f6cf9533ff4a.tar.gz
nextcloud-server-849587ae2b47393ac3797eb0c242f6cf9533ff4a.zip
Merge pull request #45213 from nextcloud/backport/45058/stable27
[stable27] perf(db): Sort data for IN before chunking
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 5a3e38dd569..9822b6874f9 100644
--- a/lib/private/Files/Cache/Cache.php
+++ b/lib/private/Files/Cache/Cache.php
@@ -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();