mirror of https://github.com/nextcloud/server
perf(db): Sort data for IN before chunking
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
This commit is contained in:
parent
10af08736e
commit
f3d6309e36
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue