From da0a35dd40d272d67faad39dabdefcbba7cde529 Mon Sep 17 00:00:00 2001 From: Jean-Marie Renouard Date: Tue, 26 Sep 2023 22:42:36 +0200 Subject: [PATCH] Bug: Database with views only gets index recommendation #721 --- mysqltuner.pl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mysqltuner.pl b/mysqltuner.pl index 9ae7e617d..df511de48 100644 --- a/mysqltuner.pl +++ b/mysqltuner.pl @@ -7076,9 +7076,12 @@ sub mysql_indexes { infoprint " +-- COMMENT : " . $info[5] if defined $info[5]; $found++; } - badprint "No index found for $dbname database" if $found == 0; + my $nbTables=select_one( +"SELECT count(*) from information_schema.TABLES WHERE TABLE_TYPE ='BASE TABLE' AND TABLE_SCHEMA='$dbname'" + ); + badprint "No index found for $dbname database" if $found == 0 and $nbTables>1; push @generalrec, "Add indexes on tables from $dbname database" - if $found == 0; + if $found == 0 and $nbTables>1; } return unless ( defined( $myvar{'performance_schema'} )