From f52b2b03c651dfcd88afd999cce769255f64ebbf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BCller?= <1005065+DeepDiver1975@users.noreply.github.com> Date: Mon, 28 Nov 2022 10:01:49 +0100 Subject: [PATCH] fix: optimize preview cleanup sql --- lib/private/PreviewCleanup.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/private/PreviewCleanup.php b/lib/private/PreviewCleanup.php index 5b2b29fca0cb..94932fb8e30f 100644 --- a/lib/private/PreviewCleanup.php +++ b/lib/private/PreviewCleanup.php @@ -80,7 +80,7 @@ private function queryPreviewsToDelete(int $startFileId = 0, int $chunkSize = 10 $sql = "select `fileid`, `name`, `user_id` from `*PREFIX*filecache` `fc` join `*PREFIX*mounts` on `storage` = `storage_id` where `parent` in (select `fileid` from `*PREFIX*filecache` where `storage` in (select `numeric_id` from `oc_storages` where `id` like 'home::%' or `id` like 'object::user:%') and `path` = 'thumbnails') - and not exists(select `fileid` from `*PREFIX*filecache` where `fc`.`name` = CAST(`*PREFIX*filecache`.`fileid` as CHAR(24))) + and `fc`.`fileid` not in (select `fileid` from `*PREFIX*filecache` where `fc`.`name` = CAST(`*PREFIX*filecache`.`fileid` as CHAR(24))) and `fc`.`fileid` > ? order by `user_id`, `fileid`";