From cbad61f1666cb5b04a3c6a48fc4fb28d8d3a4a89 Mon Sep 17 00:00:00 2001 From: Benjamin Gaussorgues Date: Mon, 21 Sep 2026 16:01:39 +0200 Subject: [PATCH] fix(db-usage): fix DB index usage query Signed-off-by: Benjamin Gaussorgues --- core/Command/Db/DbIndexUsage.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/core/Command/Db/DbIndexUsage.php b/core/Command/Db/DbIndexUsage.php index d523908339870..c84a227f12ba2 100644 --- a/core/Command/Db/DbIndexUsage.php +++ b/core/Command/Db/DbIndexUsage.php @@ -19,7 +19,6 @@ use Symfony\Component\Console\Output\OutputInterface; class DbIndexUsage extends Command { - public function __construct( private readonly Connection $connection, ) { @@ -46,8 +45,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int $unused_filter = $showAll ? '' : "WHERE s.count_read = 0 AND s.index_name IS NOT NULL AND s.index_name != 'PRIMARY'"; $sql = "SELECT s.object_name AS `table`, s.index_name AS `index`, - s.count_read AS reads, - s.count_write AS writes + s.count_read AS `reads`, + s.count_write AS `writes` FROM performance_schema.table_io_waits_summary_by_index_usage s {$unused_filter} ORDER BY s.object_name, s.index_name"; @@ -105,7 +104,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int if (!$showAll) { $output->writeln(sprintf( 'Found %d unused index(es). If those were not created by Nextcloud, consider removing them to improve write performance.', - count($rows) + count($rows), )); }