aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2025-05-26 18:08:36 +0200
committerbackportbot[bot] <backportbot[bot]@users.noreply.github.com>2025-05-27 12:37:50 +0000
commite089474887a887c031c5cdbcbb44384a33e9f4ac (patch)
tree975ad882d346c66970703c71dd6b5634ba75a5e6
parente4261a6be11bff1e6a0364841ffc111e997aa71e (diff)
downloadnextcloud-server-backport/53120/stable30.tar.gz
nextcloud-server-backport/53120/stable30.zip
perf: improve query to determine which users need a background scanbackport/53120/stable30
Signed-off-by: Robin Appelman <robin@icewind.nl>
-rw-r--r--apps/files/lib/BackgroundJob/ScanFiles.php6
1 files changed, 3 insertions, 3 deletions
diff --git a/apps/files/lib/BackgroundJob/ScanFiles.php b/apps/files/lib/BackgroundJob/ScanFiles.php
index b7e6e8db10e..cb2d8e218f7 100644
--- a/apps/files/lib/BackgroundJob/ScanFiles.php
+++ b/apps/files/lib/BackgroundJob/ScanFiles.php
@@ -79,7 +79,7 @@ class ScanFiles extends TimedJob {
$query->select('m.user_id')
->from('filecache', 'f')
->leftJoin('f', 'mounts', 'm', $query->expr()->eq('m.storage_id', 'f.storage'))
- ->where($query->expr()->lt('f.size', $query->createNamedParameter(0, IQueryBuilder::PARAM_INT)))
+ ->where($query->expr()->eq('f.size', $query->createNamedParameter(-1, IQueryBuilder::PARAM_INT)))
->andWhere($query->expr()->gt('f.parent', $query->createNamedParameter(-1, IQueryBuilder::PARAM_INT)))
->setMaxResults(10)
->groupBy('f.storage')
@@ -100,7 +100,7 @@ class ScanFiles extends TimedJob {
$query->select('m.user_id')
->from('filecache', 'f')
->leftJoin('f', 'mounts', 'm', $query->expr()->eq('m.storage_id', 'f.storage'))
- ->where($query->expr()->lt('f.size', $query->createNamedParameter(0, IQueryBuilder::PARAM_INT)))
+ ->where($query->expr()->eq('f.size', $query->createNamedParameter(-1, IQueryBuilder::PARAM_INT)))
->andWhere($query->expr()->gt('f.parent', $query->createNamedParameter(-1, IQueryBuilder::PARAM_INT)))
->andWhere($query->expr()->in('f.storage', $query->createNamedParameter($storages, IQueryBuilder::PARAM_INT_ARRAY)))
->setMaxResults(1)
@@ -111,7 +111,7 @@ class ScanFiles extends TimedJob {
$query->select('m.user_id')
->from('filecache', 'f')
->innerJoin('f', 'mounts', 'm', $query->expr()->eq('m.storage_id', 'f.storage'))
- ->where($query->expr()->lt('f.size', $query->createNamedParameter(0, IQueryBuilder::PARAM_INT)))
+ ->where($query->expr()->eq('f.size', $query->createNamedParameter(-1, IQueryBuilder::PARAM_INT)))
->andWhere($query->expr()->gt('f.parent', $query->createNamedParameter(-1, IQueryBuilder::PARAM_INT)))
->setMaxResults(1)
->runAcrossAllShards();