Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
perf(db): Sort data for IN before chunking
Signed-off-by: Christoph Wurst <[email protected]>
  • Loading branch information
ChristophWurst authored and joshtrichards committed May 29, 2024
commit 66898f82f1ff2590bbd49f0cb8c8084173942b06
3 changes: 3 additions & 0 deletions lib/private/Files/Cache/Cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,9 @@ private function removeChildren(ICacheEntry $entry) {
$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();
Expand Down