diff options
author | Josh <josh.t.richards@gmail.com> | 2024-05-28 17:04:56 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-28 17:04:56 -0400 |
commit | 413526a688287ae466b617e0190c17286a1954be (patch) | |
tree | ff87ea8e52d604ac5dd9b301225d79fedd8f5d24 | |
parent | 2a61d2bcdb73c37523d7ec674b99f4837dfe7803 (diff) | |
parent | 9c4d8b3337146e9f35e0b7f110bef9d059236f8b (diff) | |
download | nextcloud-server-413526a688287ae466b617e0190c17286a1954be.tar.gz nextcloud-server-413526a688287ae466b617e0190c17286a1954be.zip |
Merge pull request #45215 from nextcloud/backport/45058/stable29
[stable29] perf(db): Sort data for IN before chunking
-rw-r--r-- | lib/private/Files/Cache/Cache.php | 3 |
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(); |