diff options
author | Robin Appelman <robin@icewind.nl> | 2025-05-26 18:08:36 +0200 |
---|---|---|
committer | backportbot[bot] <backportbot[bot]@users.noreply.github.com> | 2025-05-27 12:37:51 +0000 |
commit | 97cf88da29c1f76a8b6a1465c6ce71f604133ef4 (patch) | |
tree | 8c0f38653c79ec4df2d6408ad994b31b33c9f923 | |
parent | a0d4ec53818e3204bc896d47dc6472554b1d7234 (diff) | |
download | nextcloud-server-backport/53120/stable31.tar.gz nextcloud-server-backport/53120/stable31.zip |
perf: improve query to determine which users need a background scanbackport/53120/stable31
Signed-off-by: Robin Appelman <robin@icewind.nl>
-rw-r--r-- | apps/files/lib/BackgroundJob/ScanFiles.php | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/apps/files/lib/BackgroundJob/ScanFiles.php b/apps/files/lib/BackgroundJob/ScanFiles.php index 3a39382d0b4..f3f9093d648 100644 --- a/apps/files/lib/BackgroundJob/ScanFiles.php +++ b/apps/files/lib/BackgroundJob/ScanFiles.php @@ -69,7 +69,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') @@ -90,7 +90,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) @@ -101,7 +101,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(); |