diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2024-04-26 15:38:29 +0200 |
---|---|---|
committer | Josh <josh.t.richards@gmail.com> | 2024-05-25 20:50:56 -0400 |
commit | b226039fe9c6aab8950165923ffba9d75fafaa74 (patch) | |
tree | 04fef1713c3993b976bc98f2aec86eef1087dbdc | |
parent | b127e020ec7edb4ae2bde89e3eaea13bd081f494 (diff) | |
download | nextcloud-server-b226039fe9c6aab8950165923ffba9d75fafaa74.tar.gz nextcloud-server-b226039fe9c6aab8950165923ffba9d75fafaa74.zip |
perf(db): Sort data for IN before chunking
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
-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 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(); |