From 30e35a84113609f929ec8a569c15bc4134dae845 Mon Sep 17 00:00:00 2001 From: Benjamin Gaussorgues Date: Wed, 18 Feb 2026 15:46:50 +0100 Subject: [PATCH] fix(perf): use index when deleting old previews Signed-off-by: Benjamin Gaussorgues --- lib/private/Preview/PreviewMigrationService.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/private/Preview/PreviewMigrationService.php b/lib/private/Preview/PreviewMigrationService.php index d3db56fc69c..7c7581c6318 100644 --- a/lib/private/Preview/PreviewMigrationService.php +++ b/lib/private/Preview/PreviewMigrationService.php @@ -161,12 +161,16 @@ class PreviewMigrationService { private function deleteFolder(string $path): void { $current = $path; + $rootFolderId = $this->rootFolder->getMountPoint()->getNumericStorageId(); while (true) { $appDataPath = $this->previewRootPath . $current; $qb = $this->connection->getQueryBuilder(); $qb->delete('filecache') ->where($qb->expr()->eq('path_hash', $qb->createNamedParameter(md5($appDataPath)))) - ->hintShardKey('storage', $this->rootFolder->getMountPoint()->getNumericStorageId()) + ->andWhere($qb->expr()->eq( + 'storage', + $qb->createNamedParameter($rootFolderId), + )) ->executeStatement(); $current = dirname($current);