Merge branch 'master' of https://github.com/major/MySQLTuner-perl
This commit is contained in:
		
						commit
						07cfdafaa7
					
				
					 3 changed files with 388 additions and 176 deletions
				
			
		
							
								
								
									
										10
									
								
								USAGE.md
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								USAGE.md
									
									
									
									
									
								
							|  | @ -1,6 +1,6 @@ | ||||||
| # NAME | # NAME | ||||||
| 
 | 
 | ||||||
|     MySQLTuner 1.9.4 - MySQL High Performance Tuning Script |     MySQLTuner2.0.5 - MySQL High Performance Tuning Script | ||||||
| 
 | 
 | ||||||
| # IMPORTANT USAGE GUIDELINES | # IMPORTANT USAGE GUIDELINES | ||||||
| 
 | 
 | ||||||
|  | @ -31,7 +31,7 @@ You must provide the remote server's total memory when connecting to other serve | ||||||
|                                 (Recommended for servers with many tables) |                                 (Recommended for servers with many tables) | ||||||
|     --json                      Print result as JSON string |     --json                      Print result as JSON string | ||||||
|     --prettyjson                Print result as JSON formatted string |     --prettyjson                Print result as JSON formatted string | ||||||
|     --skippassword              Don't perform checks on user passwords(default: off) |     --skippassword              Don't perform checks on user passwords (default: off) | ||||||
|     --checkversion              Check for updates to MySQLTuner (default: don't check) |     --checkversion              Check for updates to MySQLTuner (default: don't check) | ||||||
|     --updateversion             Check for updates to MySQLTuner and update when newer version is available (default: don't check) |     --updateversion             Check for updates to MySQLTuner and update when newer version is available (default: don't check) | ||||||
|     --forcemem <size>           Amount of RAM installed in megabytes |     --forcemem <size>           Amount of RAM installed in megabytes | ||||||
|  | @ -64,9 +64,9 @@ You must provide the remote server's total memory when connecting to other serve | ||||||
|     --nosysstat                 Don't Print system information |     --nosysstat                 Don't Print system information | ||||||
|     --pfstat                    Print Performance schema |     --pfstat                    Print Performance schema | ||||||
|     --nopfstat                  Don't Print Performance schema |     --nopfstat                  Don't Print Performance schema | ||||||
|     --bannedports               Ports banned separated by comma(,) |     --bannedports               Ports banned separated by comma (,) | ||||||
|     --server-log                Define specifi error_log to analyze |     --server-log                Define specific error_log to analyze | ||||||
|     --maxportallowed            Number of ports opened allowed on this hosts |     --maxportallowed            Number of ports opened allowed on this host | ||||||
|     --buffers                   Print global and per-thread buffer values |     --buffers                   Print global and per-thread buffer values | ||||||
| 
 | 
 | ||||||
| # PERLDOC | # PERLDOC | ||||||
|  |  | ||||||
							
								
								
									
										291
									
								
								mysqltuner.pl
									
									
									
									
									
								
							
							
						
						
									
										291
									
								
								mysqltuner.pl
									
									
									
									
									
								
							|  | @ -1,5 +1,5 @@ | ||||||
| #!/usr/bin/env perl | #!/usr/bin/env perl | ||||||
| # mysqltuner.pl - Version 2.0.4 | # mysqltuner.pl - Version2.0.5 | ||||||
| # High Performance MySQL Tuning Script | # High Performance MySQL Tuning Script | ||||||
| # Copyright (C) 2006-2022 Major Hayden - major@mhtx.net | # Copyright (C) 2006-2022 Major Hayden - major@mhtx.net | ||||||
| # Copyright (C) 2015-2022 Jean-Marie Renouard - jmrenouard@gmail.com | # Copyright (C) 2015-2022 Jean-Marie Renouard - jmrenouard@gmail.com | ||||||
|  | @ -256,7 +256,7 @@ my @dblist; | ||||||
| # Super structure containing all information | # Super structure containing all information | ||||||
| my %result; | my %result; | ||||||
| $result{'MySQLTuner'}{'version'}  = $tunerversion; | $result{'MySQLTuner'}{'version'}  = $tunerversion; | ||||||
| $result{'MySQLTuner'}{'datetime'} =`date '+%d-%m-%Y %H:%M:%S'`; | $result{'MySQLTuner'}{'datetime'} = `date '+%d-%m-%Y %H:%M:%S'`; | ||||||
| $result{'MySQLTuner'}{'options'}  = \%opt; | $result{'MySQLTuner'}{'options'}  = \%opt; | ||||||
| 
 | 
 | ||||||
| # Functions that handle the print styles | # Functions that handle the print styles | ||||||
|  | @ -594,7 +594,7 @@ sub update_tuner_version { | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     my $update; |     my $update; | ||||||
|     my $fullpath=""; |     my $fullpath = ""; | ||||||
|     my $url = "https://raw.githubusercontent.com/major/MySQLTuner-perl/master/"; |     my $url = "https://raw.githubusercontent.com/major/MySQLTuner-perl/master/"; | ||||||
|     my @scripts = |     my @scripts = | ||||||
|       ( "mysqltuner.pl", "basic_passwords.txt", "vulnerabilities.csv" ); |       ( "mysqltuner.pl", "basic_passwords.txt", "vulnerabilities.csv" ); | ||||||
|  | @ -607,12 +607,12 @@ sub update_tuner_version { | ||||||
|         if ( $httpcli =~ /curl$/ ) { |         if ( $httpcli =~ /curl$/ ) { | ||||||
|             debugprint "$httpcli is available."; |             debugprint "$httpcli is available."; | ||||||
| 
 | 
 | ||||||
|             $fullpath=dirname(__FILE__)."/".$script; |             $fullpath = dirname(__FILE__) . "/" . $script; | ||||||
|             debugprint "FullPath: $fullpath"; |             debugprint "FullPath: $fullpath"; | ||||||
|             debugprint |             debugprint | ||||||
|               "$httpcli --connect-timeout 3 '$url$script' 2>$devnull > $fullpath"; | "$httpcli --connect-timeout 3 '$url$script' 2>$devnull > $fullpath"; | ||||||
|             $update = |             $update = | ||||||
|               `$httpcli --connect-timeout 3 '$url$script' 2>$devnull > $fullpath`; | `$httpcli --connect-timeout 3 '$url$script' 2>$devnull > $fullpath`; | ||||||
|             chomp($update); |             chomp($update); | ||||||
|             debugprint "$script updated: $update"; |             debugprint "$script updated: $update"; | ||||||
| 
 | 
 | ||||||
|  | @ -655,7 +655,7 @@ sub update_tuner_version { | ||||||
|     else { |     else { | ||||||
|         badprint "Couldn't update MySQLTuner script"; |         badprint "Couldn't update MySQLTuner script"; | ||||||
|     } |     } | ||||||
|     infoprint "Stopping program: MySQLTuner has be updated."; |     infoprint "Stopping program: MySQLTuner script must be updated first."; | ||||||
|     exit 0; |     exit 0; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -666,11 +666,11 @@ sub compare_tuner_version { | ||||||
|     #exit 0; |     #exit 0; | ||||||
|     if ( $remoteversion ne $tunerversion ) { |     if ( $remoteversion ne $tunerversion ) { | ||||||
|         badprint |         badprint | ||||||
|           "There is a new version of MySQLTuner available($remoteversion)"; |           "There is a new version of MySQLTuner available ($remoteversion)"; | ||||||
|         update_tuner_version(); |         update_tuner_version(); | ||||||
|         return; |         return; | ||||||
|     } |     } | ||||||
|     goodprint "You have the latest version of MySQLTuner($tunerversion)"; |     goodprint "You have the latest version of MySQLTuner ($tunerversion)"; | ||||||
|     return; |     return; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -681,7 +681,7 @@ my $osname = $^O; | ||||||
| if ( $osname eq 'MSWin32' ) { | if ( $osname eq 'MSWin32' ) { | ||||||
|     eval { require Win32; } or last; |     eval { require Win32; } or last; | ||||||
|     $osname = Win32::GetOSName(); |     $osname = Win32::GetOSName(); | ||||||
|     infoprint "* Windows OS($osname) is not fully supported.\n"; |     infoprint "* Windows OS ($osname) is not fully supported.\n"; | ||||||
| 
 | 
 | ||||||
|     #exit 1; |     #exit 1; | ||||||
| } | } | ||||||
|  | @ -747,7 +747,7 @@ sub mysql_setup { | ||||||
|         $remotestring = " -S $opt{socket} -P $opt{port}"; |         $remotestring = " -S $opt{socket} -P $opt{port}"; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     if ( $opt{protocol} ne '' ){ |     if ( $opt{protocol} ne '' ) { | ||||||
|         $remotestring = " --protocol=$opt{protocol}"; |         $remotestring = " --protocol=$opt{protocol}"; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -1174,7 +1174,7 @@ sub get_all_vars { | ||||||
|     $dummyselect = select_one "SELECT VERSION()"; |     $dummyselect = select_one "SELECT VERSION()"; | ||||||
|     if ( not defined($dummyselect) or $dummyselect eq "" ) { |     if ( not defined($dummyselect) or $dummyselect eq "" ) { | ||||||
|         badprint |         badprint | ||||||
| "You probably did not get enough privileges for running MySQLTuner ..."; | "You probably do not have enough privileges to run MySQLTuner ..."; | ||||||
|         exit(256); |         exit(256); | ||||||
|     } |     } | ||||||
|     $dummyselect =~ s/(.*?)\-.*/$1/; |     $dummyselect =~ s/(.*?)\-.*/$1/; | ||||||
|  | @ -1359,7 +1359,8 @@ sub log_file_recommendations { | ||||||
| 
 | 
 | ||||||
|     subheaderprint "Log file Recommendations"; |     subheaderprint "Log file Recommendations"; | ||||||
|     if ( "$myvar{'log_error'}" eq "stderr" ) { |     if ( "$myvar{'log_error'}" eq "stderr" ) { | ||||||
|         badprint "log_error is set to $myvar{'log_error'}, but this script can't read stderr"; |         badprint | ||||||
|  | "log_error is set to $myvar{'log_error'}, but this script can't read stderr"; | ||||||
|         return; |         return; | ||||||
|     } |     } | ||||||
|     elsif ( $myvar{'log_error'} =~ /^(docker|podman|kubectl):(.*)/ ) { |     elsif ( $myvar{'log_error'} =~ /^(docker|podman|kubectl):(.*)/ ) { | ||||||
|  | @ -1513,7 +1514,7 @@ sub cve_recommendations { | ||||||
|     if ( $mysqlvermajor eq 5 and $mysqlverminor eq 5 ) { |     if ( $mysqlvermajor eq 5 and $mysqlverminor eq 5 ) { | ||||||
|         infoprint |         infoprint | ||||||
|           "False positive CVE(s) for MySQL and MariaDB 5.5.x can be found."; |           "False positive CVE(s) for MySQL and MariaDB 5.5.x can be found."; | ||||||
|         infoprint "Check careful each CVE for those particular versions"; |         infoprint "Check carefully each CVE for those particular versions"; | ||||||
|     } |     } | ||||||
|     badprint $cvefound . " CVE(s) found for your MySQL release."; |     badprint $cvefound . " CVE(s) found for your MySQL release."; | ||||||
|     push( @generalrec, |     push( @generalrec, | ||||||
|  | @ -1873,7 +1874,7 @@ sub system_recommendations { | ||||||
|           . scalar @opened_ports |           . scalar @opened_ports | ||||||
|           . " listening port(s) on this server."; |           . " listening port(s) on this server."; | ||||||
|         if ( scalar(@opened_ports) > $opt{'maxportallowed'} ) { |         if ( scalar(@opened_ports) > $opt{'maxportallowed'} ) { | ||||||
|             badprint "There is too many listening ports: " |             badprint "There are too many listening ports: " | ||||||
|               . scalar(@opened_ports) |               . scalar(@opened_ports) | ||||||
|               . " opened > " |               . " opened > " | ||||||
|               . $opt{'maxportallowed'} |               . $opt{'maxportallowed'} | ||||||
|  | @ -1883,7 +1884,7 @@ sub system_recommendations { | ||||||
|             ); |             ); | ||||||
|         } |         } | ||||||
|         else { |         else { | ||||||
|             goodprint "There is less than " |             goodprint "There are less than " | ||||||
|               . $opt{'maxportallowed'} |               . $opt{'maxportallowed'} | ||||||
|               . " opened ports on this server."; |               . " opened ports on this server."; | ||||||
|         } |         } | ||||||
|  | @ -1945,21 +1946,25 @@ sub security_recommendations { | ||||||
|     debugprint "Password column = $PASS_COLUMN_NAME"; |     debugprint "Password column = $PASS_COLUMN_NAME"; | ||||||
| 
 | 
 | ||||||
|     # IS THERE A ROLE COLUMN |     # IS THERE A ROLE COLUMN | ||||||
|     my $is_role_column = select_one "select count(*) from information_schema.columns where TABLE_NAME='user' AND TABLE_SCHEMA='mysql' and COLUMN_NAME='IS_ROLE'"; |     my $is_role_column = select_one | ||||||
|  | "select count(*) from information_schema.columns where TABLE_NAME='user' AND TABLE_SCHEMA='mysql' and COLUMN_NAME='IS_ROLE'"; | ||||||
| 
 | 
 | ||||||
|     my $extra_user_condition=""; |     my $extra_user_condition = ""; | ||||||
|     $extra_user_condition="IS_ROLE = 'N' AND" if $is_role_column > 0; |     $extra_user_condition = "IS_ROLE = 'N' AND" if $is_role_column > 0; | ||||||
|     my @mysqlstatlist; |     my @mysqlstatlist; | ||||||
|     if ($is_role_column > 0) { |     if ( $is_role_column > 0 ) { | ||||||
|         @mysqlstatlist= select_array "SELECT CONCAT(QUOTE(user), '\@', QUOTE(host)) FROM mysql.user WHERE IS_ROLE='Y'"; |         @mysqlstatlist = select_array | ||||||
|  | "SELECT CONCAT(QUOTE(user), '\@', QUOTE(host)) FROM mysql.user WHERE IS_ROLE='Y'"; | ||||||
|         foreach my $line ( sort @mysqlstatlist ) { |         foreach my $line ( sort @mysqlstatlist ) { | ||||||
|             chomp($line); |             chomp($line); | ||||||
|             infoprint "User $line is User Role"; |             infoprint "User $line is User Role"; | ||||||
|         } |         } | ||||||
|     } else { |     } | ||||||
|  |     else { | ||||||
|         debugprint "No Role user detected"; |         debugprint "No Role user detected"; | ||||||
|         goodprint "No Role user detected"; |         goodprint "No Role user detected"; | ||||||
|     } |     } | ||||||
|  | 
 | ||||||
|     # Looking for Anonymous users |     # Looking for Anonymous users | ||||||
|     @mysqlstatlist = select_array |     @mysqlstatlist = select_array | ||||||
| "SELECT CONCAT(QUOTE(user), '\@', QUOTE(host)) FROM mysql.user WHERE $extra_user_condition (TRIM(USER) = '' OR USER IS NULL)"; | "SELECT CONCAT(QUOTE(user), '\@', QUOTE(host)) FROM mysql.user WHERE $extra_user_condition (TRIM(USER) = '' OR USER IS NULL)"; | ||||||
|  | @ -1985,7 +1990,7 @@ sub security_recommendations { | ||||||
|     } |     } | ||||||
|     if ( mysql_version_le( 5, 1 ) ) { |     if ( mysql_version_le( 5, 1 ) ) { | ||||||
|         badprint "No more password checks for MySQL version <=5.1"; |         badprint "No more password checks for MySQL version <=5.1"; | ||||||
|         badprint "MySQL version <=5.1 are deprecated and end of support."; |         badprint "MySQL version <=5.1 is deprecated and end of support."; | ||||||
|         return; |         return; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -2093,7 +2098,7 @@ q{SELECT CONCAT(QUOTE(user), '@', QUOTE(host)) FROM mysql.global_priv WHERE | ||||||
|               . $pass |               . $pass | ||||||
|               . "', 2, LENGTH('" |               . "', 2, LENGTH('" | ||||||
|               . $pass . "'))))"; |               . $pass . "'))))"; | ||||||
|             debugprint "There is " . scalar(@mysqlstatlist) . " items."; |             debugprint "There are " . scalar(@mysqlstatlist) . " items."; | ||||||
|             if (@mysqlstatlist) { |             if (@mysqlstatlist) { | ||||||
|                 foreach my $line (@mysqlstatlist) { |                 foreach my $line (@mysqlstatlist) { | ||||||
|                     chomp($line); |                     chomp($line); | ||||||
|  | @ -2135,14 +2140,22 @@ sub get_replication_status { | ||||||
| 
 | 
 | ||||||
|     infoprint "Semi synchronous replication Master: " |     infoprint "Semi synchronous replication Master: " | ||||||
|       . ( |       . ( | ||||||
|         ( defined( $myvar{'rpl_semi_sync_master_enabled'} ) or defined( $myvar{'rpl_semi_sync_source_enabled'} ) ) |         ( | ||||||
|         ? ( $myvar{'rpl_semi_sync_master_enabled'} // $myvar{'rpl_semi_sync_source_enabled'} ) |                  defined( $myvar{'rpl_semi_sync_master_enabled'} ) | ||||||
|  |               or defined( $myvar{'rpl_semi_sync_source_enabled'} ) | ||||||
|  |         ) | ||||||
|  |         ? ( $myvar{'rpl_semi_sync_master_enabled'} | ||||||
|  |               // $myvar{'rpl_semi_sync_source_enabled'} ) | ||||||
|         : 'Not Activated' |         : 'Not Activated' | ||||||
|       ); |       ); | ||||||
|     infoprint "Semi synchronous replication Slave: " |     infoprint "Semi synchronous replication Slave: " | ||||||
|       . ( |       . ( | ||||||
|         ( defined( $myvar{'rpl_semi_sync_slave_enabled'} ) or defined( $myvar{'rpl_semi_sync_replica_enabled'} ) ) |         ( | ||||||
|         ? ( $myvar{'rpl_semi_sync_slave_enabled'} // $myvar{'rpl_semi_sync_replica_enabled'} ) |                  defined( $myvar{'rpl_semi_sync_slave_enabled'} ) | ||||||
|  |               or defined( $myvar{'rpl_semi_sync_replica_enabled'} ) | ||||||
|  |         ) | ||||||
|  |         ? ( $myvar{'rpl_semi_sync_slave_enabled'} | ||||||
|  |               // $myvar{'rpl_semi_sync_replica_enabled'} ) | ||||||
|         : 'Not Activated' |         : 'Not Activated' | ||||||
|       ); |       ); | ||||||
|     if ( scalar( keys %myrepl ) == 0 and scalar( keys %myslaves ) == 0 ) { |     if ( scalar( keys %myrepl ) == 0 and scalar( keys %myslaves ) == 0 ) { | ||||||
|  | @ -2156,13 +2169,15 @@ sub get_replication_status { | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     $result{'Replication'}{'status'} = \%myrepl; |     $result{'Replication'}{'status'} = \%myrepl; | ||||||
|     my ($io_running) = $myrepl{'Slave_IO_Running'} // $myrepl{'Replica_IO_Running'}; |     my ($io_running) = $myrepl{'Slave_IO_Running'} | ||||||
|  |       // $myrepl{'Replica_IO_Running'}; | ||||||
|     debugprint "IO RUNNING: $io_running "; |     debugprint "IO RUNNING: $io_running "; | ||||||
|     my ($sql_running) = $myrepl{'Slave_SQL_Running'} // $myrepl{'Replica_SQL_Running'}; |     my ($sql_running) = $myrepl{'Slave_SQL_Running'} | ||||||
|  |       // $myrepl{'Replica_SQL_Running'}; | ||||||
|     debugprint "SQL RUNNING: $sql_running "; |     debugprint "SQL RUNNING: $sql_running "; | ||||||
| 
 | 
 | ||||||
| 
 |     my ($seconds_behind_master) = $myrepl{'Seconds_Behind_Master'} | ||||||
|     my ($seconds_behind_master) = $myrepl{'Seconds_Behind_Master'} // $myrepl{'Seconds_Behind_Source'} ; |       // $myrepl{'Seconds_Behind_Source'}; | ||||||
|     $seconds_behind_master = 1000000 unless defined($seconds_behind_master); |     $seconds_behind_master = 1000000 unless defined($seconds_behind_master); | ||||||
|     debugprint "SECONDS : $seconds_behind_master "; |     debugprint "SECONDS : $seconds_behind_master "; | ||||||
| 
 | 
 | ||||||
|  | @ -2209,18 +2224,20 @@ sub validate_mysql_version { | ||||||
|         or mysql_version_eq( 10, 5 ) |         or mysql_version_eq( 10, 5 ) | ||||||
|         or mysql_version_eq( 10, 6 ) |         or mysql_version_eq( 10, 6 ) | ||||||
|         or mysql_version_eq( 10, 7 ) |         or mysql_version_eq( 10, 7 ) | ||||||
|         or mysql_version_eq( 10, 8 ) |         or mysql_version_eq( 10, 8 ) ) | ||||||
|     ) |  | ||||||
|     { |     { | ||||||
|         goodprint "Currently running supported MySQL version " |         goodprint "Currently running supported MySQL version " | ||||||
|           . $myvar{'version'} . ""; |           . $myvar{'version'} . ""; | ||||||
|         return; |         return; | ||||||
|     } else { |     } | ||||||
|  |     else { | ||||||
|         badprint "Your MySQL version " |         badprint "Your MySQL version " | ||||||
|           . $myvar{'version'} |           . $myvar{'version'} | ||||||
|           . " is EOL software!  Upgrade soon!"; |           . " is EOL software. Upgrade soon!"; | ||||||
|         push ( @generalrec, "You are using n unsupported version for production environments"); |         push( @generalrec, | ||||||
|         push ( @generalrec, "Upgrade as soon as possible to a supported version !"); |             "You are using an unsupported version for production environments" ); | ||||||
|  |         push( @generalrec, | ||||||
|  |             "Upgrade as soon as possible to a supported version !" ); | ||||||
| 
 | 
 | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | @ -2407,7 +2424,7 @@ sub check_storage_engines { | ||||||
| 
 | 
 | ||||||
| # MySQL 5 servers can have table sizes calculated quickly from information schema | # MySQL 5 servers can have table sizes calculated quickly from information schema | ||||||
|         my @templist = select_array |         my @templist = select_array | ||||||
| "SELECT ENGINE,SUM(DATA_LENGTH+INDEX_LENGTH),COUNT(ENGINE),SUM(DATA_LENGTH),SUM(INDEX_LENGTH) FROM information_schema.TABLES WHERE TABLE_SCHEMA NOT IN ('information_schema', 'performance_schema', 'mysql') AND ENGINE IS NOT NULL GROUP BY ENGINE ORDER BY ENGINE ASC;"; | "SELECT ENGINE, SUM(DATA_LENGTH+INDEX_LENGTH), COUNT(ENGINE), SUM(DATA_LENGTH), SUM(INDEX_LENGTH) FROM information_schema.TABLES WHERE TABLE_SCHEMA NOT IN ('information_schema', 'performance_schema', 'mysql') AND ENGINE IS NOT NULL GROUP BY ENGINE ORDER BY ENGINE ASC;"; | ||||||
| 
 | 
 | ||||||
|         my ( $engine, $size, $count, $dsize, $isize ); |         my ( $engine, $size, $count, $dsize, $isize ); | ||||||
|         foreach my $line (@templist) { |         foreach my $line (@templist) { | ||||||
|  | @ -2516,9 +2533,9 @@ sub check_storage_engines { | ||||||
|         && defined $myvar{'have_isam'} |         && defined $myvar{'have_isam'} | ||||||
|         && $myvar{'have_isam'} eq "YES" ) |         && $myvar{'have_isam'} eq "YES" ) | ||||||
|     { |     { | ||||||
|         badprint "MYISAM is enabled but isn't being used"; |         badprint "MyISAM is enabled but isn't being used"; | ||||||
|         push( @generalrec, |         push( @generalrec, | ||||||
| "Add skip-isam to MySQL configuration to disable ISAM (MySQL > 4.1.0)" |             "Add skip-isam to MySQL configuration to disable MyISAM (MySQL > 4.1.0)" | ||||||
|         ); |         ); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -2590,7 +2607,6 @@ sub check_storage_engines { | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| 
 |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| my %mycalc; | my %mycalc; | ||||||
|  | @ -2777,9 +2793,9 @@ sub calculations { | ||||||
|     } |     } | ||||||
|     elsif ( mysql_version_ge(5) ) { |     elsif ( mysql_version_ge(5) ) { | ||||||
|         $mycalc{'total_myisam_indexes'} = select_one |         $mycalc{'total_myisam_indexes'} = select_one | ||||||
| "SELECT IFNULL(SUM(INDEX_LENGTH),0) FROM information_schema.TABLES WHERE TABLE_SCHEMA NOT IN ('information_schema') AND ENGINE = 'MyISAM';"; | "SELECT IFNULL(SUM(INDEX_LENGTH), 0) FROM information_schema.TABLES WHERE TABLE_SCHEMA NOT IN ('information_schema') AND ENGINE = 'MyISAM';"; | ||||||
|         $mycalc{'total_aria_indexes'} = select_one |         $mycalc{'total_aria_indexes'} = select_one | ||||||
| "SELECT IFNULL(SUM(INDEX_LENGTH),0) FROM information_schema.TABLES WHERE TABLE_SCHEMA NOT IN ('information_schema') AND ENGINE = 'Aria';"; | "SELECT IFNULL(SUM(INDEX_LENGTH), 0) FROM information_schema.TABLES WHERE TABLE_SCHEMA NOT IN ('information_schema') AND ENGINE = 'Aria';"; | ||||||
|     } |     } | ||||||
|     if ( defined $mycalc{'total_myisam_indexes'} ) { |     if ( defined $mycalc{'total_myisam_indexes'} ) { | ||||||
|         chomp( $mycalc{'total_myisam_indexes'} ); |         chomp( $mycalc{'total_myisam_indexes'} ); | ||||||
|  | @ -2860,7 +2876,6 @@ sub calculations { | ||||||
|                 ) |                 ) | ||||||
|             ); |             ); | ||||||
|         } |         } | ||||||
| 
 |  | ||||||
|     } |     } | ||||||
|     else { |     else { | ||||||
|         $mycalc{'table_cache_hit_rate'} = 100; |         $mycalc{'table_cache_hit_rate'} = 100; | ||||||
|  | @ -3188,24 +3203,27 @@ sub mysql_stats { | ||||||
|         infoprint |         infoprint | ||||||
| "Skipped name resolution test due to missing skip_name_resolve in system variables."; | "Skipped name resolution test due to missing skip_name_resolve in system variables."; | ||||||
|     } |     } | ||||||
|  | 
 | ||||||
|     #Cpanel and Skip name resolve |     #Cpanel and Skip name resolve | ||||||
|     elsif ( -r "/usr/local/cpanel/cpanel" ){ |     elsif ( -r "/usr/local/cpanel/cpanel" ) { | ||||||
|         if  ( $result{'Variables'}{'skip_name_resolve'} ne 'OFF') { |         if ( $result{'Variables'}{'skip_name_resolve'} ne 'OFF' ) { | ||||||
|             infoprint "CPanel and Flex system skip-name-resolve should be on"; |             infoprint "CPanel and Flex system skip-name-resolve should be on"; | ||||||
|         } |         } | ||||||
|         if  ( $result{'Variables'}{'skip_name_resolve'} eq 'OFF') { |         if ( $result{'Variables'}{'skip_name_resolve'} eq 'OFF' ) { | ||||||
|             badprint "CPanel and Flex system skip-name-resolve should be on"; |             badprint "CPanel and Flex system skip-name-resolve should be on"; | ||||||
|             push (@generalrec, "name resolution is enabled due to cPanel doesn't support this disabled."); |             push( @generalrec, | ||||||
|             push (@adjvars, "skip-name-resolve=0"); | "name resolution is enabled due to cPanel doesn't support this disabled." | ||||||
|  |             ); | ||||||
|  |             push( @adjvars, "skip-name-resolve=0" ); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|     elsif ( $result{'Variables'}{'skip_name_resolve'} eq 'OFF' ) { |     elsif ( $result{'Variables'}{'skip_name_resolve'} eq 'OFF' ) { | ||||||
|         badprint |         badprint | ||||||
| "Name resolution is active: a reverse name resolution is made for each new connection and can reduce performance"; | "Name resolution is active: a reverse name resolution is made for each new connection which can reduce performance"; | ||||||
|         push( @generalrec, |         push( @generalrec, | ||||||
| "Configure your accounts with ip or subnets only, then update your configuration with skip-name-resolve=1" | "Configure your accounts with ip or subnets only, then update your configuration with skip-name-resolve=1" | ||||||
|         ); |         ); | ||||||
|         push (@adjvars, "skip-name-resolve=1"); |         push( @adjvars, "skip-name-resolve=1" ); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     # Query cache |     # Query cache | ||||||
|  | @ -3470,7 +3488,7 @@ sub mysql_stats { | ||||||
| "This is MyISAM only table_cache scalability problem, InnoDB not affected." | "This is MyISAM only table_cache scalability problem, InnoDB not affected." | ||||||
|             ); |             ); | ||||||
|             push( @generalrec, |             push( @generalrec, | ||||||
|                 "See more details here: https://bugs.mysql.com/bug.php?id=49177" |                 "For more details see: https://bugs.mysql.com/bug.php?id=49177" | ||||||
|             ); |             ); | ||||||
|             push( @generalrec, |             push( @generalrec, | ||||||
| "This bug already fixed in MySQL 5.7.9 and newer MySQL versions." | "This bug already fixed in MySQL 5.7.9 and newer MySQL versions." | ||||||
|  | @ -3510,7 +3528,7 @@ sub mysql_stats { | ||||||
|     $mycalc{'total_tables'} = $nbtables; |     $mycalc{'total_tables'} = $nbtables; | ||||||
|     if ( defined $myvar{'table_definition_cache'} ) { |     if ( defined $myvar{'table_definition_cache'} ) { | ||||||
|         if ( $myvar{'table_definition_cache'} == -1 ) { |         if ( $myvar{'table_definition_cache'} == -1 ) { | ||||||
|             infoprint( "table_definition_cache(" |             infoprint( "table_definition_cache (" | ||||||
|                   . $myvar{'table_definition_cache'} |                   . $myvar{'table_definition_cache'} | ||||||
|                   . ") is in autosizing mode" ); |                   . ") is in autosizing mode" ); | ||||||
|         } |         } | ||||||
|  | @ -3519,7 +3537,7 @@ sub mysql_stats { | ||||||
|               . $myvar{'table_definition_cache'} |               . $myvar{'table_definition_cache'} | ||||||
|               . ") is less than number of tables ($nbtables) "; |               . ") is less than number of tables ($nbtables) "; | ||||||
|             push( @adjvars, |             push( @adjvars, | ||||||
|                     "table_definition_cache(" |                     "table_definition_cache (" | ||||||
|                   . $myvar{'table_definition_cache'} . ") > " |                   . $myvar{'table_definition_cache'} . ") > " | ||||||
|                   . $nbtables |                   . $nbtables | ||||||
|                   . " or -1 (autosizing if supported)" ); |                   . " or -1 (autosizing if supported)" ); | ||||||
|  | @ -3619,16 +3637,16 @@ sub mysql_stats { | ||||||
| sub mysql_myisam { | sub mysql_myisam { | ||||||
|     subheaderprint "MyISAM Metrics"; |     subheaderprint "MyISAM Metrics"; | ||||||
|     if ( mysql_version_ge(8) and mysql_version_le(10) ) { |     if ( mysql_version_ge(8) and mysql_version_le(10) ) { | ||||||
|         infoprint "MyISAM Metrics are disabled on last MySQL versions."; |         infoprint "MyISAM Metrics are disabled since MySQL 8.0."; | ||||||
|         if ( $myvar{'key_buffer_size'} > 0) { |         if ( $myvar{'key_buffer_size'} > 0 ) { | ||||||
|             push( @adjvars, "key_buffer_size=0" ); |             push( @adjvars, "key_buffer_size=0" ); | ||||||
|             push( @generalrec, "Buffer Key MyISAM set to 0, no MyISAM table detected" ); |             push( @generalrec, | ||||||
|  |                 "Buffer Key MyISAM set to 0, no MyISAM table detected" ); | ||||||
|         } |         } | ||||||
|         return; |         return; | ||||||
|     } |     } | ||||||
|     my $nb_myisam_tables=select_one( |     my $nb_myisam_tables = select_one( | ||||||
| "SELECT COUNT(*) FROM information_schema.TABLES WHERE ENGINE='MyISAM'" |         "SELECT COUNT(*) FROM information_schema.TABLES WHERE ENGINE='MyISAM'"); | ||||||
|               ); |  | ||||||
|     if ( $nb_myisam_tables == 0 ) { |     if ( $nb_myisam_tables == 0 ) { | ||||||
|         infoprint "No MyISAM table(s) detected ...."; |         infoprint "No MyISAM table(s) detected ...."; | ||||||
|         return; |         return; | ||||||
|  | @ -3823,13 +3841,13 @@ sub mariadb_threadpool { | ||||||
|         if ( $myvar{'thread_pool_size'} < 4 or $myvar{'thread_pool_size'} > 8 ) |         if ( $myvar{'thread_pool_size'} < 4 or $myvar{'thread_pool_size'} > 8 ) | ||||||
|         { |         { | ||||||
|             badprint |             badprint | ||||||
| "thread_pool_size between 4 and 8 when using MyIsam storage engine."; | "thread_pool_size between 4 and 8 when using MyISAM storage engine."; | ||||||
|             push( @generalrec, |             push( @generalrec, | ||||||
|                     "Thread pool size for MyIsam usage (" |                     "Thread pool size for MyISAM usage (" | ||||||
|                   . $myvar{'thread_pool_size'} |                   . $myvar{'thread_pool_size'} | ||||||
|                   . ")" ); |                   . ")" ); | ||||||
|             push( @adjvars, |             push( @adjvars, | ||||||
|                 "thread_pool_size between 4 and 8 for MyIsam usage" ); |                 "thread_pool_size between 4 and 8 for MyISAM usage" ); | ||||||
|         } |         } | ||||||
|         else { |         else { | ||||||
|             goodprint |             goodprint | ||||||
|  | @ -3858,12 +3876,11 @@ sub mysqsl_pfs { | ||||||
|     # Performance Schema |     # Performance Schema | ||||||
|     $myvar{'performance_schema'} = 'OFF' |     $myvar{'performance_schema'} = 'OFF' | ||||||
|       unless defined( $myvar{'performance_schema'} ); |       unless defined( $myvar{'performance_schema'} ); | ||||||
|     if ($myvar{'performance_schema'} eq 'OFF') { |     if ( $myvar{'performance_schema'} eq 'OFF' ) { | ||||||
|         badprint "Performance_schema should be activated."; |         badprint "Performance_schema should be activated."; | ||||||
|         push( @adjvars, "performance_schema=ON" ); |         push( @adjvars, "performance_schema=ON" ); | ||||||
|         push( @generalrec, |         push( @generalrec, | ||||||
|                 "Performance schema should be activated for better diagnostics" |             "Performance schema should be activated for better diagnostics" ); | ||||||
|             ); |  | ||||||
|     } |     } | ||||||
|     if ( $myvar{'performance_schema'} eq 'ON' ) { |     if ( $myvar{'performance_schema'} eq 'ON' ) { | ||||||
|         infoprint "Performance_schema is activated."; |         infoprint "Performance_schema is activated."; | ||||||
|  | @ -3872,12 +3889,12 @@ sub mysqsl_pfs { | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     unless ( grep /^sys$/, select_array("SHOW DATABASES") ) { |     unless ( grep /^sys$/, select_array("SHOW DATABASES") ) { | ||||||
|         infoprint "Sys schema isn't installed."; |         infoprint "Sys schema is not installed."; | ||||||
|         push( @generalrec, |         push( @generalrec, | ||||||
| "Consider installing Sys schema from https://github.com/mysql/mysql-sys for MySQL" |             "Consider installing Sys schema from https://github.com/mysql/mysql-sys for MySQL" | ||||||
|         ) unless ( mysql_version_le( 5, 6 ) ); |         ) unless ( mysql_version_le( 5, 6 ) ); | ||||||
|         push( @generalrec, |         push( @generalrec, | ||||||
| "Consider installing Sys schema from https://github.com/FromDual/mariadb-sys for MariaDB" |             "Consider installing Sys schema from https://github.com/FromDual/mariadb-sys for MariaDB" | ||||||
|         ) unless ( mysql_version_ge( 10, 0 ) ); |         ) unless ( mysql_version_ge( 10, 0 ) ); | ||||||
| 
 | 
 | ||||||
|         return; |         return; | ||||||
|  | @ -3888,9 +3905,9 @@ sub mysqsl_pfs { | ||||||
|     infoprint "Sys schema Version: " |     infoprint "Sys schema Version: " | ||||||
|       . select_one("select sys_version from sys.version"); |       . select_one("select sys_version from sys.version"); | ||||||
| 
 | 
 | ||||||
|     # Store all sys schema | # Store all sys schema | ||||||
| #    for my $pfs_view(select_array('use sys;show tables;')){ | #    for my $pfs_view(select_array('use sys;show tables;')){ | ||||||
|         #infoprint "$pfs_view" | #infoprint "$pfs_view" | ||||||
| #        @$result{'sys'}{$pfs_view}{'headers'}=[]; | #        @$result{'sys'}{$pfs_view}{'headers'}=[]; | ||||||
| #        for my $h (select_array("select column_name FROM INFORMATION_SCHEMA.COLUMNS c | #        for my $h (select_array("select column_name FROM INFORMATION_SCHEMA.COLUMNS c | ||||||
| # WHERE c.table_name = '$pfs_view'  ORDER BY c.ORDINAL_POSITION")) { | # WHERE c.table_name = '$pfs_view'  ORDER BY c.ORDINAL_POSITION")) { | ||||||
|  | @ -3902,7 +3919,7 @@ sub mysqsl_pfs { | ||||||
| #            push $result{'sys'}{$pfs_view}{'values'}, $lQuery; | #            push $result{'sys'}{$pfs_view}{'values'}, $lQuery; | ||||||
| #        } | #        } | ||||||
| #    } | #    } | ||||||
|     # Top user per connection | # Top user per connection | ||||||
|     subheaderprint "Performance schema: Top 5 user per connection"; |     subheaderprint "Performance schema: Top 5 user per connection"; | ||||||
|     my $nbL = 1; |     my $nbL = 1; | ||||||
|     for my $lQuery ( |     for my $lQuery ( | ||||||
|  | @ -4684,7 +4701,7 @@ sub mysqsl_pfs { | ||||||
| 
 | 
 | ||||||
|     #schema_index_statistics |     #schema_index_statistics | ||||||
|     # TOP 15 most read index |     # TOP 15 most read index | ||||||
|     subheaderprint "Performance schema: TOP 15 most read indexes"; |     subheaderprint "Performance schema: Top 15 most read indexes"; | ||||||
|     $nbL = 1; |     $nbL = 1; | ||||||
|     for my $lQuery ( |     for my $lQuery ( | ||||||
|         select_array( |         select_array( | ||||||
|  | @ -4774,7 +4791,7 @@ sub mysqsl_pfs { | ||||||
|       if ( $nbL == 1 ); |       if ( $nbL == 1 ); | ||||||
| 
 | 
 | ||||||
|     # TOP 15 most read tables |     # TOP 15 most read tables | ||||||
|     subheaderprint "Performance schema: TOP 15 most read tables"; |     subheaderprint "Performance schema: Top 15 most read tables"; | ||||||
|     $nbL = 1; |     $nbL = 1; | ||||||
|     for my $lQuery ( |     for my $lQuery ( | ||||||
|         select_array( |         select_array( | ||||||
|  | @ -4974,7 +4991,7 @@ sub mysqsl_pfs { | ||||||
|     infoprint "No information found or indicators deactivated." |     infoprint "No information found or indicators deactivated." | ||||||
|       if ( $nbL == 1 ); |       if ( $nbL == 1 ); | ||||||
| 
 | 
 | ||||||
|     subheaderprint "Performance schema: TOP 15 reader queries (95% percentile)"; |     subheaderprint "Performance schema: Top 15 reader queries (95% percentile)"; | ||||||
|     $nbL = 1; |     $nbL = 1; | ||||||
|     for my $lQuery ( |     for my $lQuery ( | ||||||
|         select_array( |         select_array( | ||||||
|  | @ -4989,7 +5006,7 @@ sub mysqsl_pfs { | ||||||
|       if ( $nbL == 1 ); |       if ( $nbL == 1 ); | ||||||
| 
 | 
 | ||||||
|     subheaderprint |     subheaderprint | ||||||
|       "Performance schema: TOP 15 most row look queries (95% percentile)"; |       "Performance schema: Top 15 most row look queries (95% percentile)"; | ||||||
|     $nbL = 1; |     $nbL = 1; | ||||||
|     for my $lQuery ( |     for my $lQuery ( | ||||||
|         select_array( |         select_array( | ||||||
|  | @ -5004,7 +5021,7 @@ sub mysqsl_pfs { | ||||||
|       if ( $nbL == 1 ); |       if ( $nbL == 1 ); | ||||||
| 
 | 
 | ||||||
|     subheaderprint |     subheaderprint | ||||||
|       "Performance schema: TOP 15 total latency queries (95% percentile)"; |       "Performance schema: Top 15 total latency queries (95% percentile)"; | ||||||
|     $nbL = 1; |     $nbL = 1; | ||||||
|     for my $lQuery ( |     for my $lQuery ( | ||||||
|         select_array( |         select_array( | ||||||
|  | @ -5019,7 +5036,7 @@ sub mysqsl_pfs { | ||||||
|       if ( $nbL == 1 ); |       if ( $nbL == 1 ); | ||||||
| 
 | 
 | ||||||
|     subheaderprint |     subheaderprint | ||||||
|       "Performance schema: TOP 15 max latency queries (95% percentile)"; |       "Performance schema: Top 15 max latency queries (95% percentile)"; | ||||||
|     $nbL = 1; |     $nbL = 1; | ||||||
|     for my $lQuery ( |     for my $lQuery ( | ||||||
|         select_array( |         select_array( | ||||||
|  | @ -5034,7 +5051,7 @@ sub mysqsl_pfs { | ||||||
|       if ( $nbL == 1 ); |       if ( $nbL == 1 ); | ||||||
| 
 | 
 | ||||||
|     subheaderprint |     subheaderprint | ||||||
|       "Performance schema: TOP 15 average latency queries (95% percentile)"; |       "Performance schema: Top 15 average latency queries (95% percentile)"; | ||||||
|     $nbL = 1; |     $nbL = 1; | ||||||
|     for my $lQuery ( |     for my $lQuery ( | ||||||
|         select_array( |         select_array( | ||||||
|  | @ -5076,7 +5093,7 @@ sub mysqsl_pfs { | ||||||
|     infoprint "No information found or indicators deactivated." |     infoprint "No information found or indicators deactivated." | ||||||
|       if ( $nbL == 1 ); |       if ( $nbL == 1 ); | ||||||
| 
 | 
 | ||||||
|     subheaderprint "Performance schema: TOP 15 row sorting queries with sort"; |     subheaderprint "Performance schema: Top 15 row sorting queries with sort"; | ||||||
|     $nbL = 1; |     $nbL = 1; | ||||||
|     for my $lQuery ( |     for my $lQuery ( | ||||||
|         select_array( |         select_array( | ||||||
|  | @ -5090,7 +5107,7 @@ sub mysqsl_pfs { | ||||||
|     infoprint "No information found or indicators deactivated." |     infoprint "No information found or indicators deactivated." | ||||||
|       if ( $nbL == 1 ); |       if ( $nbL == 1 ); | ||||||
| 
 | 
 | ||||||
|     subheaderprint "Performance schema: TOP 15 total latency queries with sort"; |     subheaderprint "Performance schema: Top 15 total latency queries with sort"; | ||||||
|     $nbL = 1; |     $nbL = 1; | ||||||
|     for my $lQuery ( |     for my $lQuery ( | ||||||
|         select_array( |         select_array( | ||||||
|  | @ -5104,7 +5121,7 @@ sub mysqsl_pfs { | ||||||
|     infoprint "No information found or indicators deactivated." |     infoprint "No information found or indicators deactivated." | ||||||
|       if ( $nbL == 1 ); |       if ( $nbL == 1 ); | ||||||
| 
 | 
 | ||||||
|     subheaderprint "Performance schema: TOP 15 merge queries with sort"; |     subheaderprint "Performance schema: Top 15 merge queries with sort"; | ||||||
|     $nbL = 1; |     $nbL = 1; | ||||||
|     for my $lQuery ( |     for my $lQuery ( | ||||||
|         select_array( |         select_array( | ||||||
|  | @ -5119,7 +5136,7 @@ sub mysqsl_pfs { | ||||||
|       if ( $nbL == 1 ); |       if ( $nbL == 1 ); | ||||||
| 
 | 
 | ||||||
|     subheaderprint |     subheaderprint | ||||||
|       "Performance schema: TOP 15 average sort merges queries with sort"; |       "Performance schema: Top 15 average sort merges queries with sort"; | ||||||
|     $nbL = 1; |     $nbL = 1; | ||||||
|     for my $lQuery ( |     for my $lQuery ( | ||||||
|         select_array( |         select_array( | ||||||
|  | @ -5133,7 +5150,7 @@ sub mysqsl_pfs { | ||||||
|     infoprint "No information found or indicators deactivated." |     infoprint "No information found or indicators deactivated." | ||||||
|       if ( $nbL == 1 ); |       if ( $nbL == 1 ); | ||||||
| 
 | 
 | ||||||
|     subheaderprint "Performance schema: TOP 15 scans queries with sort"; |     subheaderprint "Performance schema: Top 15 scans queries with sort"; | ||||||
|     $nbL = 1; |     $nbL = 1; | ||||||
|     for my $lQuery ( |     for my $lQuery ( | ||||||
|         select_array( |         select_array( | ||||||
|  | @ -5147,7 +5164,7 @@ sub mysqsl_pfs { | ||||||
|     infoprint "No information found or indicators deactivated." |     infoprint "No information found or indicators deactivated." | ||||||
|       if ( $nbL == 1 ); |       if ( $nbL == 1 ); | ||||||
| 
 | 
 | ||||||
|     subheaderprint "Performance schema: TOP 15 range queries with sort"; |     subheaderprint "Performance schema: Top 15 range queries with sort"; | ||||||
|     $nbL = 1; |     $nbL = 1; | ||||||
|     for my $lQuery ( |     for my $lQuery ( | ||||||
|         select_array( |         select_array( | ||||||
|  | @ -5212,7 +5229,7 @@ sub mysqsl_pfs { | ||||||
|       if ( $nbL == 1 ); |       if ( $nbL == 1 ); | ||||||
| 
 | 
 | ||||||
|     subheaderprint |     subheaderprint | ||||||
|       "Performance schema: TOP 15 total latency queries with temp table"; |       "Performance schema: Top 15 total latency queries with temp table"; | ||||||
|     $nbL = 1; |     $nbL = 1; | ||||||
|     for my $lQuery ( |     for my $lQuery ( | ||||||
|         select_array( |         select_array( | ||||||
|  | @ -5226,7 +5243,7 @@ sub mysqsl_pfs { | ||||||
|     infoprint "No information found or indicators deactivated." |     infoprint "No information found or indicators deactivated." | ||||||
|       if ( $nbL == 1 ); |       if ( $nbL == 1 ); | ||||||
| 
 | 
 | ||||||
|     subheaderprint "Performance schema: TOP 15 queries with temp table to disk"; |     subheaderprint "Performance schema: Top 15 queries with temp table to disk"; | ||||||
|     $nbL = 1; |     $nbL = 1; | ||||||
|     for my $lQuery ( |     for my $lQuery ( | ||||||
|         select_array( |         select_array( | ||||||
|  | @ -5243,7 +5260,7 @@ sub mysqsl_pfs { | ||||||
| ################################################################################## | ################################################################################## | ||||||
|     #wait_classes_global_by_latency |     #wait_classes_global_by_latency | ||||||
| 
 | 
 | ||||||
| #ysql> select * from wait_classes_global_by_latency; | #mysql> select * from wait_classes_global_by_latency; | ||||||
| #-----------------+-------+---------------+-------------+-------------+-------------+ | #-----------------+-------+---------------+-------------+-------------+-------------+ | ||||||
| # event_class     | total | total_latency | min_latency | avg_latency | max_latency | | # event_class     | total | total_latency | min_latency | avg_latency | max_latency | | ||||||
| #-----------------+-------+---------------+-------------+-------------+-------------+ | #-----------------+-------+---------------+-------------+-------------+-------------+ | ||||||
|  | @ -5253,7 +5270,7 @@ sub mysqsl_pfs { | ||||||
| #-----------------+-------+---------------+-------------+-------------+-------------+ | #-----------------+-------+---------------+-------------+-------------+-------------+ | ||||||
| # rows in set (0,00 sec) | # rows in set (0,00 sec) | ||||||
| 
 | 
 | ||||||
|     subheaderprint "Performance schema: TOP 15 class events by number"; |     subheaderprint "Performance schema: Top 15 class events by number"; | ||||||
|     $nbL = 1; |     $nbL = 1; | ||||||
|     for my $lQuery ( |     for my $lQuery ( | ||||||
|         select_array( |         select_array( | ||||||
|  | @ -5267,7 +5284,7 @@ sub mysqsl_pfs { | ||||||
|     infoprint "No information found or indicators deactivated." |     infoprint "No information found or indicators deactivated." | ||||||
|       if ( $nbL == 1 ); |       if ( $nbL == 1 ); | ||||||
| 
 | 
 | ||||||
|     subheaderprint "Performance schema: TOP 30 events by number"; |     subheaderprint "Performance schema: Top 30 events by number"; | ||||||
|     $nbL = 1; |     $nbL = 1; | ||||||
|     for my $lQuery ( |     for my $lQuery ( | ||||||
|         select_array( |         select_array( | ||||||
|  | @ -5281,7 +5298,7 @@ sub mysqsl_pfs { | ||||||
|     infoprint "No information found or indicators deactivated." |     infoprint "No information found or indicators deactivated." | ||||||
|       if ( $nbL == 1 ); |       if ( $nbL == 1 ); | ||||||
| 
 | 
 | ||||||
|     subheaderprint "Performance schema: TOP 15 class events by total latency"; |     subheaderprint "Performance schema: Top 15 class events by total latency"; | ||||||
|     $nbL = 1; |     $nbL = 1; | ||||||
|     for my $lQuery ( |     for my $lQuery ( | ||||||
|         select_array( |         select_array( | ||||||
|  | @ -5295,7 +5312,7 @@ sub mysqsl_pfs { | ||||||
|     infoprint "No information found or indicators deactivated." |     infoprint "No information found or indicators deactivated." | ||||||
|       if ( $nbL == 1 ); |       if ( $nbL == 1 ); | ||||||
| 
 | 
 | ||||||
|     subheaderprint "Performance schema: TOP 30 events by total latency"; |     subheaderprint "Performance schema: Top 30 events by total latency"; | ||||||
|     $nbL = 1; |     $nbL = 1; | ||||||
|     for my $lQuery ( |     for my $lQuery ( | ||||||
|         select_array( |         select_array( | ||||||
|  | @ -5309,7 +5326,7 @@ sub mysqsl_pfs { | ||||||
|     infoprint "No information found or indicators deactivated." |     infoprint "No information found or indicators deactivated." | ||||||
|       if ( $nbL == 1 ); |       if ( $nbL == 1 ); | ||||||
| 
 | 
 | ||||||
|     subheaderprint "Performance schema: TOP 15 class events by max latency"; |     subheaderprint "Performance schema: Top 15 class events by max latency"; | ||||||
|     $nbL = 1; |     $nbL = 1; | ||||||
|     for my $lQuery ( |     for my $lQuery ( | ||||||
|         select_array( |         select_array( | ||||||
|  | @ -5323,7 +5340,7 @@ sub mysqsl_pfs { | ||||||
|     infoprint "No information found or indicators deactivated." |     infoprint "No information found or indicators deactivated." | ||||||
|       if ( $nbL == 1 ); |       if ( $nbL == 1 ); | ||||||
| 
 | 
 | ||||||
|     subheaderprint "Performance schema: TOP 30 events by max latency"; |     subheaderprint "Performance schema: Top 30 events by max latency"; | ||||||
|     $nbL = 1; |     $nbL = 1; | ||||||
|     for my $lQuery ( |     for my $lQuery ( | ||||||
|         select_array( |         select_array( | ||||||
|  | @ -5573,26 +5590,26 @@ group by c.table_schema,c.table_name | ||||||
| having sum(if(c.column_key in ('PRI','UNI'), 1,0)) = 0" | having sum(if(c.column_key in ('PRI','UNI'), 1,0)) = 0" | ||||||
|     ); |     ); | ||||||
| 
 | 
 | ||||||
|     infoprint "CPU core detected  : " . (cpu_cores); |     infoprint "CPU cores detected : " . (cpu_cores); | ||||||
|     infoprint "wsrep_slave_threads: " . get_wsrep_option('wsrep_slave_threads'); |     infoprint "wsrep_slave_threads: " . get_wsrep_option('wsrep_slave_threads'); | ||||||
| 
 | 
 | ||||||
|     if (   get_wsrep_option('wsrep_slave_threads') > ( (cpu_cores) * 4 ) |     if (   get_wsrep_option('wsrep_slave_threads') > ( (cpu_cores) * 4 ) | ||||||
|         or get_wsrep_option('wsrep_slave_threads') < ( (cpu_cores) * 2 ) ) |         or get_wsrep_option('wsrep_slave_threads') < ( (cpu_cores) * 2 ) ) | ||||||
|     { |     { | ||||||
|         badprint |         badprint | ||||||
| "wsrep_slave_threads is not equal to 2, 3 or 4 times number of CPU(s)"; |             "wsrep_slave_threads is not equal to 2, 3 or 4 times the number of CPU(s)"; | ||||||
|         push @adjvars, "wsrep_slave_threads = " . ( (cpu_cores) * 4 ); |         push @adjvars, "wsrep_slave_threads = " . ( (cpu_cores) * 4 ); | ||||||
|     } |     } | ||||||
|     else { |     else { | ||||||
|         goodprint |         goodprint | ||||||
|           "wsrep_slave_threads is equal to 2, 3 or 4 times number of CPU(s)"; |           "wsrep_slave_threads is equal to 2, 3 or 4 times the number of CPU(s)"; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     if ( get_wsrep_option('wsrep_slave_threads') > 1 ) { |     if ( get_wsrep_option('wsrep_slave_threads') > 1 ) { | ||||||
|         infoprint |         infoprint | ||||||
|           "wsrep parallel slave can cause frequent inconsistency crash."; |           "wsrep parallel slave can cause frequent inconsistency crash."; | ||||||
|         push @adjvars, |         push @adjvars, | ||||||
| "Set wsrep_slave_threads to 1 in case of HA_ERR_FOUND_DUPP_KEY crash on slave"; |             "Set wsrep_slave_threads to 1 in case of HA_ERR_FOUND_DUPP_KEY crash on slave"; | ||||||
| 
 | 
 | ||||||
|         # check options for parallel slave |         # check options for parallel slave | ||||||
|         if ( get_wsrep_option('wsrep_slave_FK_checks') eq "OFF" ) { |         if ( get_wsrep_option('wsrep_slave_FK_checks') eq "OFF" ) { | ||||||
|  | @ -5635,7 +5652,7 @@ having sum(if(c.column_key in ('PRI','UNI'), 1,0)) = 0" | ||||||
|     } |     } | ||||||
|     else { |     else { | ||||||
|         goodprint |         goodprint | ||||||
| "Flow control fraction seems to be OK (wsrep_flow_control_paused<=0.02)"; |             "Flow control fraction seems to be OK (wsrep_flow_control_paused <= 0.02)"; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     if ( scalar(@primaryKeysNbTables) > 0 ) { |     if ( scalar(@primaryKeysNbTables) > 0 ) { | ||||||
|  | @ -5697,14 +5714,14 @@ having sum(if(c.column_key in ('PRI','UNI'), 1,0)) = 0" | ||||||
|             } |             } | ||||||
|             else { |             else { | ||||||
|                 badprint |                 badprint | ||||||
| "There are $nbNodesSize nodes in wsrep_cluster_size. Prefer 3 or 5 nodes architecture."; |             "There are $nbNodesSize nodes in wsrep_cluster_size. Prefer 3 or 5 nodes architecture."; | ||||||
|                 push @generalrec, "Prefer 3 or 5 nodes architecture."; |                 push @generalrec, "Prefer 3 or 5 nodes architecture."; | ||||||
|             } |             } | ||||||
| 
 | 
 | ||||||
|             # wsrep_cluster_address doesn't include garbd nodes |             # wsrep_cluster_address doesn't include garbd nodes | ||||||
|             if ( $nbNodes > $nbNodesSize ) { |             if ( $nbNodes > $nbNodesSize ) { | ||||||
|                 badprint |                 badprint | ||||||
| "All cluster nodes are not detected. wsrep_cluster_size less then node count in wsrep_cluster_address"; |             "All cluster nodes are not detected. wsrep_cluster_size less than node count in wsrep_cluster_address"; | ||||||
|             } |             } | ||||||
|             else { |             else { | ||||||
|                 goodprint "All cluster nodes detected."; |                 goodprint "All cluster nodes detected."; | ||||||
|  | @ -5742,14 +5759,14 @@ having sum(if(c.column_key in ('PRI','UNI'), 1,0)) = 0" | ||||||
|         } |         } | ||||||
|         else { |         else { | ||||||
|             badprint "Galera Notify command is not defined."; |             badprint "Galera Notify command is not defined."; | ||||||
|             push( @adjvars, "set up parameter wsrep_notify_cmd to be notify" ); |             push( @adjvars, "set up parameter wsrep_notify_cmd to be notified" ); | ||||||
|         } |         } | ||||||
|         if (    trim( $myvar{'wsrep_sst_method'} ) !~ "^xtrabackup.*" |         if (    trim( $myvar{'wsrep_sst_method'} ) !~ "^xtrabackup.*" | ||||||
|             and trim( $myvar{'wsrep_sst_method'} ) !~ "^mariabackup" ) |             and trim( $myvar{'wsrep_sst_method'} ) !~ "^mariabackup" ) | ||||||
|         { |         { | ||||||
|             badprint "Galera SST method is not xtrabackup based."; |             badprint "Galera SST method is not xtrabackup based."; | ||||||
|             push( @adjvars, |             push( @adjvars, | ||||||
| "set up parameter wsrep_sst_method to xtrabackup based parameter" |             "set up parameter wsrep_sst_method to xtrabackup based parameter" | ||||||
|             ); |             ); | ||||||
|         } |         } | ||||||
|         else { |         else { | ||||||
|  | @ -5851,10 +5868,10 @@ sub mysql_innodb { | ||||||
|             $defengine = $myvar{'default_storage_engine'} |             $defengine = $myvar{'default_storage_engine'} | ||||||
|               if defined( $myvar{'default_storage_engine'} ); |               if defined( $myvar{'default_storage_engine'} ); | ||||||
|             badprint |             badprint | ||||||
| "InnoDB Storage engine is disabled. $defengine is the default storage engine" |             "InnoDB Storage engine is disabled. $defengine is the default storage engine" | ||||||
|               if $defengine eq 'InnoDB'; |               if $defengine eq 'InnoDB'; | ||||||
|             infoprint |             infoprint | ||||||
| "InnoDB Storage engine is disabled. $defengine is the default storage engine" |             "InnoDB Storage engine is disabled. $defengine is the default storage engine" | ||||||
|               if $defengine ne 'InnoDB'; |               if $defengine ne 'InnoDB'; | ||||||
|         } |         } | ||||||
|         return; |         return; | ||||||
|  | @ -5934,12 +5951,12 @@ sub mysql_innodb { | ||||||
|     # InnoDB Buffer Pool Size |     # InnoDB Buffer Pool Size | ||||||
|     if ( $myvar{'innodb_buffer_pool_size'} > $enginestats{'InnoDB'} ) { |     if ( $myvar{'innodb_buffer_pool_size'} > $enginestats{'InnoDB'} ) { | ||||||
|         goodprint "InnoDB buffer pool / data size: " |         goodprint "InnoDB buffer pool / data size: " | ||||||
|           . hr_bytes( $myvar{'innodb_buffer_pool_size'} ) . "/" |           . hr_bytes( $myvar{'innodb_buffer_pool_size'} ) . " / " | ||||||
|           . hr_bytes( $enginestats{'InnoDB'} ) . ""; |           . hr_bytes( $enginestats{'InnoDB'} ) . ""; | ||||||
|     } |     } | ||||||
|     else { |     else { | ||||||
|         badprint "InnoDB buffer pool / data size: " |         badprint "InnoDB buffer pool / data size: " | ||||||
|           . hr_bytes( $myvar{'innodb_buffer_pool_size'} ) . "/" |           . hr_bytes( $myvar{'innodb_buffer_pool_size'} ) . " / " | ||||||
|           . hr_bytes( $enginestats{'InnoDB'} ) . ""; |           . hr_bytes( $enginestats{'InnoDB'} ) . ""; | ||||||
|         push( @adjvars, |         push( @adjvars, | ||||||
|                 "innodb_buffer_pool_size (>= " |                 "innodb_buffer_pool_size (>= " | ||||||
|  | @ -5952,7 +5969,7 @@ sub mysql_innodb { | ||||||
|         badprint "Ratio InnoDB log file size / InnoDB Buffer pool size (" |         badprint "Ratio InnoDB log file size / InnoDB Buffer pool size (" | ||||||
|           . $mycalc{'innodb_log_size_pct'} . "%): " |           . $mycalc{'innodb_log_size_pct'} . "%): " | ||||||
|           . hr_bytes( $myvar{'innodb_log_file_size'} ) . " * " |           . hr_bytes( $myvar{'innodb_log_file_size'} ) . " * " | ||||||
|           . $myvar{'innodb_log_files_in_group'} . "/" |           . $myvar{'innodb_log_files_in_group'} . " / " | ||||||
|           . hr_bytes( $myvar{'innodb_buffer_pool_size'} ) |           . hr_bytes( $myvar{'innodb_buffer_pool_size'} ) | ||||||
|           . " should be equal to 25%"; |           . " should be equal to 25%"; | ||||||
|         push( |         push( | ||||||
|  | @ -5966,7 +5983,7 @@ sub mysql_innodb { | ||||||
|         ); |         ); | ||||||
|         if ( mysql_version_le( 5, 6, 2 ) ) { |         if ( mysql_version_le( 5, 6, 2 ) ) { | ||||||
|             push( @generalrec, |             push( @generalrec, | ||||||
| "For MySQL 5.6.2 and lower, Max combined innodb_log_file_size should have a ceiling of (4096MB / log files in group) - 1MB." | "For MySQL 5.6.2 and lower, total innodb_log_file_size should have a ceiling of (4096MB / log files in group) - 1MB." | ||||||
|             ); |             ); | ||||||
|         } |         } | ||||||
|         push( @generalrec, |         push( @generalrec, | ||||||
|  | @ -6178,7 +6195,7 @@ sub mysql_databases { | ||||||
|     subheaderprint "Database Metrics"; |     subheaderprint "Database Metrics"; | ||||||
|     unless ( mysql_version_ge( 5, 5 ) ) { |     unless ( mysql_version_ge( 5, 5 ) ) { | ||||||
|         infoprint |         infoprint | ||||||
| "Skip Database metrics from information schema missing in this version"; | "Skip Database metrics from information schema are missing in this version"; | ||||||
|         return; |         return; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -6188,20 +6205,20 @@ sub mysql_databases { | ||||||
|     infoprint "There is " . scalar(@dblist) . " Database(s)."; |     infoprint "There is " . scalar(@dblist) . " Database(s)."; | ||||||
|     my @totaldbinfo = split /\s/, |     my @totaldbinfo = split /\s/, | ||||||
|       select_one( |       select_one( | ||||||
| "SELECT SUM(TABLE_ROWS), SUM(DATA_LENGTH), SUM(INDEX_LENGTH) , SUM(DATA_LENGTH+INDEX_LENGTH), COUNT(TABLE_NAME),COUNT(DISTINCT(TABLE_COLLATION)),COUNT(DISTINCT(ENGINE)) FROM information_schema.TABLES WHERE TABLE_SCHEMA NOT IN ( 'mysql', 'performance_schema', 'information_schema', 'sys' );" | "SELECT SUM(TABLE_ROWS), SUM(DATA_LENGTH), SUM(INDEX_LENGTH), SUM(DATA_LENGTH+INDEX_LENGTH), COUNT(TABLE_NAME), COUNT(DISTINCT(TABLE_COLLATION)), COUNT(DISTINCT(ENGINE)) FROM information_schema.TABLES WHERE TABLE_SCHEMA NOT IN ('mysql', 'performance_schema', 'information_schema', 'sys');" | ||||||
|       ); |       ); | ||||||
|     infoprint "All User Databases:"; |     infoprint "All User Databases:"; | ||||||
|     infoprint " +-- TABLE : " |     infoprint " +-- TABLE : " | ||||||
|       . select_one( |       . select_one( | ||||||
| "SELECT count(*) from information_schema.TABLES WHERE TABLE_TYPE ='BASE TABLE' AND TABLE_SCHEMA NOT IN ( 'mysql', 'performance_schema', 'information_schema', 'sys' )" | "SELECT count(*) from information_schema.TABLES WHERE TABLE_TYPE ='BASE TABLE' AND TABLE_SCHEMA NOT IN ('mysql', 'performance_schema', 'information_schema', 'sys')" | ||||||
|       ) . ""; |       ) . ""; | ||||||
|     infoprint " +-- VIEW  : " |     infoprint " +-- VIEW  : " | ||||||
|       . select_one( |       . select_one( | ||||||
| "SELECT count(*) from information_schema.TABLES WHERE TABLE_TYPE ='VIEW' AND TABLE_SCHEMA NOT IN ( 'mysql', 'performance_schema', 'information_schema', 'sys' )" | "SELECT count(*) from information_schema.TABLES WHERE TABLE_TYPE ='VIEW' AND TABLE_SCHEMA NOT IN ('mysql', 'performance_schema', 'information_schema', 'sys')" | ||||||
|       ) . ""; |       ) . ""; | ||||||
|     infoprint " +-- INDEX : " |     infoprint " +-- INDEX : " | ||||||
|       . select_one( |       . select_one( | ||||||
| "SELECT count(distinct(concat(TABLE_NAME, TABLE_SCHEMA, INDEX_NAME))) from information_schema.STATISTICS WHERE TABLE_SCHEMA NOT IN ( 'mysql', 'performance_schema', 'information_schema', 'sys' )" | "SELECT count(distinct(concat(TABLE_NAME, TABLE_SCHEMA, INDEX_NAME))) from information_schema.STATISTICS WHERE TABLE_SCHEMA NOT IN ('mysql', 'performance_schema', 'information_schema', 'sys')" | ||||||
|       ) . ""; |       ) . ""; | ||||||
| 
 | 
 | ||||||
|     infoprint " +-- CHARS : " |     infoprint " +-- CHARS : " | ||||||
|  | @ -6209,7 +6226,7 @@ sub mysql_databases { | ||||||
|       . ( |       . ( | ||||||
|         join ", ", |         join ", ", | ||||||
|         select_array( |         select_array( | ||||||
| "select distinct(CHARACTER_SET_NAME) from information_schema.columns WHERE CHARACTER_SET_NAME IS NOT NULL AND TABLE_SCHEMA NOT IN ( 'mysql', 'performance_schema', 'information_schema', 'sys' );" | "select distinct(CHARACTER_SET_NAME) from information_schema.columns WHERE CHARACTER_SET_NAME IS NOT NULL AND TABLE_SCHEMA NOT IN ('mysql', 'performance_schema', 'information_schema', 'sys');" | ||||||
|         ) |         ) | ||||||
|       ) . ")"; |       ) . ")"; | ||||||
|     infoprint " +-- COLLA : " |     infoprint " +-- COLLA : " | ||||||
|  | @ -6217,7 +6234,7 @@ sub mysql_databases { | ||||||
|       . ( |       . ( | ||||||
|         join ", ", |         join ", ", | ||||||
|         select_array( |         select_array( | ||||||
| "SELECT DISTINCT(TABLE_COLLATION) FROM information_schema.TABLES WHERE TABLE_COLLATION IS NOT NULL AND TABLE_SCHEMA NOT IN ( 'mysql', 'performance_schema', 'information_schema', 'sys' );" | "SELECT DISTINCT(TABLE_COLLATION) FROM information_schema.TABLES WHERE TABLE_COLLATION IS NOT NULL AND TABLE_SCHEMA NOT IN ('mysql', 'performance_schema', 'information_schema', 'sys');" | ||||||
|         ) |         ) | ||||||
|       ) . ")"; |       ) . ")"; | ||||||
|     infoprint " +-- ROWS  : " |     infoprint " +-- ROWS  : " | ||||||
|  | @ -6234,7 +6251,7 @@ sub mysql_databases { | ||||||
|       . ( |       . ( | ||||||
|         join ", ", |         join ", ", | ||||||
|         select_array( |         select_array( | ||||||
| "SELECT DISTINCT(ENGINE) FROM information_schema.TABLES WHERE ENGINE IS NOT NULL AND TABLE_SCHEMA NOT IN ( 'mysql', 'performance_schema', 'information_schema', 'sys' );" | "SELECT DISTINCT(ENGINE) FROM information_schema.TABLES WHERE ENGINE IS NOT NULL AND TABLE_SCHEMA NOT IN ('mysql', 'performance_schema', 'information_schema', 'sys');" | ||||||
|         ) |         ) | ||||||
|       ) . ")"; |       ) . ")"; | ||||||
| 
 | 
 | ||||||
|  | @ -6252,7 +6269,7 @@ sub mysql_databases { | ||||||
|     foreach (@dblist) { |     foreach (@dblist) { | ||||||
|         my @dbinfo = split /\s/, |         my @dbinfo = split /\s/, | ||||||
|           select_one( |           select_one( | ||||||
| "SELECT TABLE_SCHEMA, SUM(TABLE_ROWS), SUM(DATA_LENGTH), SUM(INDEX_LENGTH) , SUM(DATA_LENGTH+INDEX_LENGTH), COUNT(DISTINCT ENGINE),COUNT(TABLE_NAME),COUNT(DISTINCT(TABLE_COLLATION)),COUNT(DISTINCT(ENGINE)) FROM information_schema.TABLES WHERE TABLE_SCHEMA='$_' GROUP BY TABLE_SCHEMA ORDER BY TABLE_SCHEMA" | "SELECT TABLE_SCHEMA, SUM(TABLE_ROWS), SUM(DATA_LENGTH), SUM(INDEX_LENGTH), SUM(DATA_LENGTH+INDEX_LENGTH), COUNT(DISTINCT ENGINE), COUNT(TABLE_NAME), COUNT(DISTINCT(TABLE_COLLATION)), COUNT(DISTINCT(ENGINE)) FROM information_schema.TABLES WHERE TABLE_SCHEMA='$_' GROUP BY TABLE_SCHEMA ORDER BY TABLE_SCHEMA" | ||||||
|           ); |           ); | ||||||
|         next unless defined $dbinfo[0]; |         next unless defined $dbinfo[0]; | ||||||
|         infoprint "Database: " . $dbinfo[0] . ""; |         infoprint "Database: " . $dbinfo[0] . ""; | ||||||
|  | @ -6409,12 +6426,12 @@ sub mysql_tables { | ||||||
|     subheaderprint "Table Column Metrics"; |     subheaderprint "Table Column Metrics"; | ||||||
|     unless ( mysql_version_ge( 5, 5 ) ) { |     unless ( mysql_version_ge( 5, 5 ) ) { | ||||||
|         infoprint |         infoprint | ||||||
| "Skip Database metrics from information schema missing in this version"; | "Skip Database metrics from information schema are missing in this version"; | ||||||
|         return; |         return; | ||||||
|     } |     } | ||||||
|     if ( mysql_version_ge(8) and not mysql_version_eq(10) ) { |     if ( mysql_version_ge(8) and not mysql_version_eq(10) ) { | ||||||
|         infoprint |         infoprint | ||||||
| "MySQL and Percona version 8 and greater have remove PROCEDURE ANALYSE feature"; | "MySQL and Percona version 8.0 and greater have removed PROCEDURE ANALYSE feature"; | ||||||
|         $opt{colstat} = 0; |         $opt{colstat} = 0; | ||||||
|         infoprint "Disabling colstat parameter"; |         infoprint "Disabling colstat parameter"; | ||||||
| 
 | 
 | ||||||
|  | @ -6517,7 +6534,7 @@ sub mysql_indexes { | ||||||
|     subheaderprint "Indexes Metrics"; |     subheaderprint "Indexes Metrics"; | ||||||
|     unless ( mysql_version_ge( 5, 5 ) ) { |     unless ( mysql_version_ge( 5, 5 ) ) { | ||||||
|         infoprint |         infoprint | ||||||
|           "Skip Index metrics from information schema missing in this version"; |           "Skip Index metrics from information schema are missing in this version"; | ||||||
|         return; |         return; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -6528,8 +6545,8 @@ sub mysql_indexes { | ||||||
| #    } | #    } | ||||||
|     my $selIdxReq = <<'ENDSQL'; |     my $selIdxReq = <<'ENDSQL'; | ||||||
| SELECT | SELECT | ||||||
|   CONCAT(t.TABLE_SCHEMA, '.',t.TABLE_NAME) AS 'table',  |   CONCAT(t.TABLE_SCHEMA, '.', t.TABLE_NAME) AS 'table',  | ||||||
|   CONCAT(s.INDEX_NAME, '(',s.COLUMN_NAME, ')') AS 'index' |   CONCAT(s.INDEX_NAME, '(', s.COLUMN_NAME, ')') AS 'index' | ||||||
|  , s.SEQ_IN_INDEX AS 'seq' |  , s.SEQ_IN_INDEX AS 'seq' | ||||||
|  , s2.max_columns AS 'maxcol' |  , s2.max_columns AS 'maxcol' | ||||||
|  , s.CARDINALITY  AS 'card' |  , s.CARDINALITY  AS 'card' | ||||||
|  | @ -6591,7 +6608,7 @@ ENDSQL | ||||||
|     foreach my $dbname ( select_user_dbs() ) { |     foreach my $dbname ( select_user_dbs() ) { | ||||||
|         infoprint "Database: " . $dbname . ""; |         infoprint "Database: " . $dbname . ""; | ||||||
|         $selIdxReq = <<"ENDSQL"; |         $selIdxReq = <<"ENDSQL"; | ||||||
|         SELECT  concat(table_name,'.', index_name) AS idxname, |         SELECT  concat(table_name, '.', index_name) AS idxname, | ||||||
|                 GROUP_CONCAT(column_name ORDER BY seq_in_index) AS cols, |                 GROUP_CONCAT(column_name ORDER BY seq_in_index) AS cols, | ||||||
|                 SUM(CARDINALITY) as card, |                 SUM(CARDINALITY) as card, | ||||||
|                 INDEX_TYPE as type |                 INDEX_TYPE as type | ||||||
|  | @ -6620,12 +6637,12 @@ ENDSQL | ||||||
|         and $myvar{'performance_schema'} eq 'ON' ); |         and $myvar{'performance_schema'} eq 'ON' ); | ||||||
| 
 | 
 | ||||||
|     $selIdxReq = <<'ENDSQL'; |     $selIdxReq = <<'ENDSQL'; | ||||||
| SELECT CONCAT(object_schema,'.',object_name) AS 'table', index_name | SELECT CONCAT(object_schema, '.', object_name) AS 'table', index_name | ||||||
| FROM performance_schema.table_io_waits_summary_by_index_usage | FROM performance_schema.table_io_waits_summary_by_index_usage | ||||||
| WHERE index_name IS NOT NULL | WHERE index_name IS NOT NULL | ||||||
| AND count_star =0 | AND count_star =0 | ||||||
| AND index_name <> 'PRIMARY' | AND index_name <> 'PRIMARY' | ||||||
| AND object_schema NOT IN ( 'mysql', 'performance_schema', 'information_schema' ) | AND object_schema NOT IN ('mysql', 'performance_schema', 'information_schema') | ||||||
| ORDER BY count_star, object_schema, object_name; | ORDER BY count_star, object_schema, object_name; | ||||||
| ENDSQL | ENDSQL | ||||||
|     @idxinfo = select_array($selIdxReq); |     @idxinfo = select_array($selIdxReq); | ||||||
|  | @ -6644,7 +6661,7 @@ sub mysql_views() { | ||||||
|     subheaderprint "Views Metrics"; |     subheaderprint "Views Metrics"; | ||||||
|     unless ( mysql_version_ge( 5, 5 ) ) { |     unless ( mysql_version_ge( 5, 5 ) ) { | ||||||
|         infoprint |         infoprint | ||||||
|           "Skip Index metrics from information schema missing in this version"; |           "Skip Index metrics from information schema are missing in this version"; | ||||||
|         return; |         return; | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | @ -6653,7 +6670,7 @@ sub mysql_routines() { | ||||||
|     subheaderprint "Routines Metrics"; |     subheaderprint "Routines Metrics"; | ||||||
|     unless ( mysql_version_ge( 5, 5 ) ) { |     unless ( mysql_version_ge( 5, 5 ) ) { | ||||||
|         infoprint |         infoprint | ||||||
|           "Skip Index metrics from information schema missing in this version"; |           "Skip Index metrics from information schema are missing in this version"; | ||||||
|         return; |         return; | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | @ -6662,7 +6679,7 @@ sub mysql_triggers() { | ||||||
|     subheaderprint "Triggers Metrics"; |     subheaderprint "Triggers Metrics"; | ||||||
|     unless ( mysql_version_ge( 5, 5 ) ) { |     unless ( mysql_version_ge( 5, 5 ) ) { | ||||||
|         infoprint |         infoprint | ||||||
|           "Skip Index metrics from information schema missing in this version"; |           "Skip Index metrics from information schema are missing in this version"; | ||||||
|         return; |         return; | ||||||
|     } |     } | ||||||
| } | } | ||||||
|  | @ -6695,8 +6712,7 @@ sub close_outputfile { | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| sub headerprint { | sub headerprint { | ||||||
|     prettyprint |     prettyprint " >>  MySQLTuner $tunerversion\n" | ||||||
|       " >>  MySQLTuner $tunerversion\n"  |  | ||||||
|       . "\t * Jean-Marie Renouard <jmrenouard\@gmail.com>\n" |       . "\t * Jean-Marie Renouard <jmrenouard\@gmail.com>\n" | ||||||
|       . "\t * Major Hayden <major\@mhtx.net>\n" |       . "\t * Major Hayden <major\@mhtx.net>\n" | ||||||
|       . " >>  Bug reports, feature requests, and downloads at http://mysqltuner.pl/\n" |       . " >>  Bug reports, feature requests, and downloads at http://mysqltuner.pl/\n" | ||||||
|  | @ -6889,7 +6905,7 @@ __END__ | ||||||
| 
 | 
 | ||||||
| =head1 NAME | =head1 NAME | ||||||
| 
 | 
 | ||||||
|  MySQLTuner 2.0.4 - MySQL High Performance Tuning Script |  MySQLTuner2.0.5 - MySQL High Performance Tuning Script | ||||||
| 
 | 
 | ||||||
| =head1 IMPORTANT USAGE GUIDELINES | =head1 IMPORTANT USAGE GUIDELINES | ||||||
| 
 | 
 | ||||||
|  | @ -6920,7 +6936,7 @@ You must provide the remote server's total memory when connecting to other serve | ||||||
|                              (Recommended for servers with many tables) |                              (Recommended for servers with many tables) | ||||||
|  --json                      Print result as JSON string |  --json                      Print result as JSON string | ||||||
|  --prettyjson                Print result as JSON formatted string |  --prettyjson                Print result as JSON formatted string | ||||||
|  --skippassword              Don't perform checks on user passwords(default: off) |  --skippassword              Don't perform checks on user passwords (default: off) | ||||||
|  --checkversion              Check for updates to MySQLTuner (default: don't check) |  --checkversion              Check for updates to MySQLTuner (default: don't check) | ||||||
|  --updateversion             Check for updates to MySQLTuner and update when newer version is available (default: don't check) |  --updateversion             Check for updates to MySQLTuner and update when newer version is available (default: don't check) | ||||||
|  --forcemem <size>           Amount of RAM installed in megabytes |  --forcemem <size>           Amount of RAM installed in megabytes | ||||||
|  | @ -6953,12 +6969,11 @@ You must provide the remote server's total memory when connecting to other serve | ||||||
|  --nosysstat                 Don't Print system information |  --nosysstat                 Don't Print system information | ||||||
|  --pfstat                    Print Performance schema |  --pfstat                    Print Performance schema | ||||||
|  --nopfstat                  Don't Print Performance schema |  --nopfstat                  Don't Print Performance schema | ||||||
|  --bannedports               Ports banned separated by comma(,) |  --bannedports               Ports banned separated by comma (,) | ||||||
|  --server-log                Define specifi error_log to analyze |  --server-log                Define specific error_log to analyze | ||||||
|  --maxportallowed            Number of ports opened allowed on this hosts |  --maxportallowed            Number of ports opened allowed on this host | ||||||
|  --buffers                   Print global and per-thread buffer values |  --buffers                   Print global and per-thread buffer values | ||||||
| 
 | 
 | ||||||
| 
 |  | ||||||
| =head1 PERLDOC | =head1 PERLDOC | ||||||
| 
 | 
 | ||||||
| You can find documentation for this module with the perldoc command. | You can find documentation for this module with the perldoc command. | ||||||
|  |  | ||||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
		Loading…
	
		Reference in a new issue
	
	 Jean-Marie Renouard
						Jean-Marie Renouard