diff --git a/files/mysqltuner.pl b/files/mysqltuner.pl
old mode 100644
new mode 100755
index 7790cf5202ff80dc0b3038afbfad83502a37e27c..18bc62519ef7d38681c5f00951626f38887250c1
--- a/files/mysqltuner.pl
+++ b/files/mysqltuner.pl
@@ -1,10 +1,10 @@
 #!/usr/bin/env perl
-# mysqltuner.pl - Version 1.7.5
+# mysqltuner.pl - Version 1.7.17
 # High Performance MySQL Tuning Script
-# Copyright (C) 2006-2017 Major Hayden - major@mhtx.net
+# Copyright (C) 2006-2018 Major Hayden - major@mhtx.net
 #
 # For the latest updates, please visit http://mysqltuner.com/
-# Git repository available at http://github.com/major/MySQLTuner-perl
+# Git repository available at https://github.com/major/MySQLTuner-perl
 #
 # This program is free software: you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -17,7 +17,7 @@
 # GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+# along with this program.  If not, see <https://www.gnu.org/licenses/>.
 #
 # This project would not be possible without help from:
 #   Matthew Montgomery     Paul Kehrer          Dave Burgess
@@ -34,7 +34,7 @@
 #   Julien Francoz
 #
 # Inspired by Matthew Montgomery's tuning-primer.sh script:
-# http://forge.mysql.com/projects/view.php?id=44
+# http://www.day32.com/MySQL/
 #
 package main;
 
@@ -56,7 +56,7 @@ $Data::Dumper::Pair = " : ";
 #use Env;
 
 # Set up a few variables for use in the script
-my $tunerversion = "1.7.5";
+my $tunerversion = "1.7.17";
 my ( @adjvars, @generalrec );
 
 # Set defaults
@@ -67,6 +67,7 @@ my %opt = (
     "noinfo"         => 0,
     "debug"          => 0,
     "nocolor"        => ( !-t STDOUT ),
+    "color"          => 0,
     "forcemem"       => 0,
     "forceswap"      => 0,
     "host"           => 0,
@@ -84,10 +85,17 @@ my %opt = (
     "bannedports"    => '',
     "maxportallowed" => 0,
     "outputfile"     => 0,
+    "noprocess"      => 0,
     "dbstat"         => 0,
+    "nodbstat"       => 0,
+    "tbstat"         => 0,
+    "notbstat"       => 0,
     "idxstat"        => 0,
+    "noidxstat"      => 0,
     "sysstat"        => 0,
+    "nosysstat"      => 0,
     "pfstat"         => 0,
+    "nopfstat"       => 0,
     "skippassword"   => 0,
     "noask"          => 0,
     "template"       => 0,
@@ -111,16 +119,20 @@ GetOptions(
     'mysqlcmd=s',      'help',
     'buffers',         'skippassword',
     'passwordfile=s',  'outputfile=s',
-    'silent',          'dbstat',
+    'silent',          'noask',
     'json',            'prettyjson',
-    'idxstat',         'noask',
     'template=s',      'reportfile=s',
     'cvefile=s',       'bannedports=s',
     'updateversion',   'maxportallowed=s',
-    'verbose',         'sysstat',
-    'password=s',      'pfstat',
+    'verbose',         'password=s',
     'passenv=s',       'userenv=s',
-    'defaults-file=s', 'ssl-ca=s'
+    'defaults-file=s', 'ssl-ca=s',
+    'color',           'noprocess',
+    'dbstat',          'nodbstat',
+    'tbstat',          'notbstat',
+    'sysstat',         'nosysstat',
+    'pfstat',          'nopfstat',
+    'idxstat',         'noidxstat',
   )
   or pod2usage(
     -exitval  => 1,
@@ -128,7 +140,7 @@ GetOptions(
     -sections => [
         "NAME",
         "IMPORTANT USAGE GUIDELINES",
-        "CONNECTION AND AUTHENTIFICATION",
+        "CONNECTION AND AUTHENTICATION",
         "PERFORMANCE AND REPORTING OPTIONS",
         "OUTPUT OPTIONS"
     ]
@@ -141,7 +153,7 @@ if ( defined $opt{'help'} && $opt{'help'} == 1 ) {
         -sections => [
             "NAME",
             "IMPORTANT USAGE GUIDELINES",
-            "CONNECTION AND AUTHENTIFICATION",
+            "CONNECTION AND AUTHENTICATION",
             "PERFORMANCE AND REPORTING OPTIONS",
             "OUTPUT OPTIONS"
         ]
@@ -173,12 +185,22 @@ $basic_password_files = "/usr/share/mysqltuner/basic_passwords.txt"
 if ( $opt{verbose} ) {
     $opt{checkversion} = 1;    #Check for updates to MySQLTuner
     $opt{dbstat}       = 1;    #Print database information
+    $opt{tbstat}       = 1;    #Print database information
     $opt{idxstat}      = 1;    #Print index information
     $opt{sysstat}      = 1;    #Print index information
     $opt{buffers}      = 1;    #Print global and per-thread buffer values
     $opt{pfstat}       = 1;    #Print performance schema info.
     $opt{cvefile} = 'vulnerabilities.csv';    #CVE File for vulnerability checks
 }
+$opt{nocolor} = 1 if defined( $opt{outputfile} );
+$opt{tbstat}  = 0 if ( $opt{notbstat} == 1 );    # Don't Print table information
+$opt{dbstat} = 0 if ( $opt{nodbstat} == 1 );  # Don't Print database information
+$opt{noprocess} = 0
+  if ( $opt{noprocess} == 1 );                # Don't Print process information
+$opt{sysstat} = 0 if ( $opt{nosysstat} == 1 ); # Don't Print sysstat information
+$opt{pfstat}  = 0
+  if ( $opt{nopfstat} == 1 );    # Don't Print performance schema information
+$opt{idxstat} = 0 if ( $opt{noidxstat} == 1 );   # Don't Print index information
 
 # for RPM distributions
 $opt{cvefile} = "/usr/share/mysqltuner/vulnerabilities.csv"
@@ -198,6 +220,9 @@ open( $fh, '>', $outputfile )
   or die("Fail opening $outputfile")
   if defined($outputfile);
 $opt{nocolor} = 1 if defined($outputfile);
+$opt{nocolor} = 1 unless ( -t STDOUT );
+
+$opt{nocolor} = 0 if ( $opt{color} == 1 );
 
 # Setting up the colors for the print styles
 my $me = `whoami`;
@@ -261,10 +286,10 @@ sub infoprinthcmd {
     infoprintcmd "$_[1]";
 }
 
-# Calculates the number of phyiscal cores considering HyperThreading
+# Calculates the number of physical cores considering HyperThreading
 sub cpu_cores {
     my $cntCPU =
-`awk -F: /^core id/ && !P[\$2] { CORES++; P[\$2]=1 }; /^physical id/ && !N[\$2] { CPUs++; N[\$2]=1 };  END { print CPUs*CORES } /proc/cpuinfo`;
+`awk -F: '/^core id/ && !P[\$2] { CORES++; P[\$2]=1 }; /^physical id/ && !N[\$2] { CPUs++; N[\$2]=1 };  END { print CPUs*CORES }' /proc/cpuinfo`;
     return ( $cntCPU == 0 ? `nproc` : $cntCPU );
 }
 
@@ -388,7 +413,7 @@ sub memerror {
 
 sub os_setup {
     my $os = `uname`;
-    $duflags = ( $os =~ /Linux/ ) ? '-b' : ;
+    $duflags = ( $os =~ /Linux/ ) ? '-b' : '';
     if ( $opt{'forcemem'} > 0 ) {
         $physical_memory = $opt{'forcemem'} * 1048576;
         infoprint "Assuming $opt{'forcemem'} MB of physical memory";
@@ -520,9 +545,9 @@ sub validate_tuner_version {
         debugprint "$httpcli is available.";
 
         debugprint
-"$httpcli -e timestamping=off -t 1 -T 3 -O - $url' 2>$devnull| grep 'my \$tunerversion| cut -d\\\" -f2";
+"$httpcli -e timestamping=off -t 1 -T 3 -O - '$url' 2>$devnull| grep 'my \$tunerversion'| cut -d\\\" -f2";
         $update =
-`$httpcli -e timestamping=off -t 1 -T 3 -O - $url' 2>$devnull| grep 'my \$tunerversion| cut -d\\\" -f2`;
+`$httpcli -e timestamping=off -t 1 -T 3 -O - '$url' 2>$devnull| grep 'my \$tunerversion'| cut -d\\\" -f2`;
         chomp($update);
         compare_tuner_version($update);
         return;
@@ -602,7 +627,7 @@ sub update_tuner_version {
         badprint "Couldn't update MySQLTuner script";
     }
 
-    exit 0;
+    #exit 0;
 }
 
 sub compare_tuner_version {
@@ -821,17 +846,17 @@ sub mysql_setup {
         and $opt{'defaults-file'} eq '' )
     {
 
-        # We have a debian maintenance account, use it
+        # We have a Debian maintenance account, use it
         $mysqllogin = "--defaults-file=/etc/mysql/debian.cnf";
         my $loginstatus = `$mysqladmincmd $mysqllogin ping 2>&1`;
         if ( $loginstatus =~ /mysqld is alive/ ) {
             goodprint
-              "Logged in using credentials from debian maintenance account.";
+              "Logged in using credentials from Debian maintenance account.";
             return 1;
         }
         else {
-            badprint "Attempted to use login credentials from debian maintena
-nce account, but they failed.";
+            badprint
+"Attempted to use login credentials from Debian maintenance account, but they failed.";
             exit 1;
         }
     }
@@ -851,7 +876,7 @@ nce account, but they failed.";
     }
     else {
 
-        # It's not Plesk or debian, we should try a login
+        # It's not Plesk or Debian, we should try a login
         debugprint "$mysqladmincmd $remotestring ping 2>&1";
         my $loginstatus = `$mysqladmincmd $remotestring ping 2>&1`;
         if ( $loginstatus =~ /mysqld is alive/ ) {
@@ -930,6 +955,7 @@ nce account, but they failed.";
             exit 1;
         }
     }
+
 }
 
 # MySQL Request Array
@@ -951,6 +977,12 @@ sub select_array {
     return @result;
 }
 
+sub human_size {
+    my ( $size, $n ) = ( shift, 0 );
+    ++$n and $size /= 1024 until $size < 1024;
+    return sprintf "%.2f %s", $size, (qw[ bytes KB MB GB ])[$n];
+}
+
 # MySQL Request one
 sub select_one {
     my $req = shift;
@@ -996,6 +1028,7 @@ sub select_str_g {
 
     my $req = shift;
     my $str = select_one_g $pattern, $req;
+    return () unless defined $str;
     my @val = split /:/, $str;
     shift @val;
     return trim(@val);
@@ -1045,7 +1078,7 @@ sub get_all_vars {
     $dummyselect = select_one "SELECT VERSION()";
     if ( not defined($dummyselect) or $dummyselect eq "" ) {
         badprint
-"You probably doesn't get enough privileges for running MySQLTuner ...";
+"You probably did not get enough privileges for running MySQLTuner ...";
         exit(256);
     }
     $dummyselect =~ s/(.*?)\-.*/$1/;
@@ -1061,10 +1094,16 @@ sub get_all_vars {
     push( @mysqlstatlist, select_array("SHOW GLOBAL STATUS") );
     arr2hash( \%mystat, \@mysqlstatlist );
     $result{'Status'} = \%mystat;
-
+    unless ( defined( $myvar{'innodb_support_xa'} ) ) {
+        $myvar{'innodb_support_xa'} = 'ON';
+    }
+    $mystat{'Uptime'} = 1
+      unless defined( $mystat{'Uptime'} )
+      and $mystat{'Uptime'} > 0;
     $myvar{'have_galera'} = "NO";
-    if ( defined( $myvar{'wsrep_provider_options'} )
-        && $myvar{'wsrep_provider_options'} ne "" )
+    if (   defined( $myvar{'wsrep_provider_options'} )
+        && $myvar{'wsrep_provider_options'} ne ""
+        && $myvar{'wsrep_on'} ne "OFF" )
     {
         $myvar{'have_galera'} = "YES";
         debugprint "Galera options: " . $myvar{'wsrep_provider_options'};
@@ -1158,31 +1197,62 @@ sub get_log_file_real_path {
     if ( -f "$file" ) {
         return $file;
     }
+    elsif ( -f "$hostname.log" ) {
+        return "$hostname.log";
+    }
     elsif ( -f "$hostname.err" ) {
         return "$hostname.err";
     }
-    elsif ( $datadir ne "" ) {
+    elsif ( -f "$datadir$hostname.err" ) {
         return "$datadir$hostname.err";
     }
+    elsif ( -f "$datadir$hostname.log" ) {
+        return "$datadir$hostname.log";
+    }
+    elsif ( -f "$datadir"."mysql_error.log" ) {
+        return "$datadir"."mysql_error.log";
+    }
+     elsif ( -f "/var/log/mysql.log" ) {
+        return "/var/log/mysql.log";
+    }
+    elsif ( -f "/var/log/mysqld.log" ) {
+        return "/var/log/mysqld.log";
+    }
+    elsif ( -f "/var/log/mysql/$hostname.err" ) {
+        return "/var/log/mysql/$hostname.err";
+    }
+    elsif ( -f "/var/log/mysql/$hostname.log" ) {
+        return "/var/log/mysql/$hostname.log";
+    }
+    elsif ( -f "/var/log/mysql/"."mysql_error.log" ) {
+        return "/var/log/mysql/"."mysql_error.log";
+    }
     else {
         return $file;
     }
 }
 
-sub log_file_recommandations {
+sub log_file_recommendations {
     $myvar{'log_error'} =
       get_log_file_real_path( $myvar{'log_error'}, $myvar{'hostname'},
         $myvar{'datadir'} );
+
     subheaderprint "Log file Recommendations";
-    infoprint "Log file: "
-      . $myvar{'log_error'} . "("
-      . hr_bytes_rnd( ( stat $myvar{'log_error'} )[7] ) . ")";
+    if ( "$myvar{'log_error'}" eq "stderr" ) {
+        badprint "log_error is set to $myvar{'log_error'} MT can't read stderr";
+        return
+    }
     if ( -f "$myvar{'log_error'}" ) {
         goodprint "Log file $myvar{'log_error'} exists";
     }
     else {
         badprint "Log file $myvar{'log_error'} doesn't exist";
+        return;
     }
+    infoprint "Log file: "
+      . $myvar{'log_error'} . "("
+      . hr_bytes_rnd( ( stat $myvar{'log_error'} )[7] ) . ")";
+
     if ( -r "$myvar{'log_error'}" ) {
         goodprint "Log file $myvar{'log_error'} is readable.";
     }
@@ -1287,7 +1357,7 @@ sub cve_recommendations {
         my @cve = split( ';', $cveline );
         debugprint
 "Comparing $mysqlvermajor\.$mysqlverminor\.$mysqlvermicro with $cve[1]\.$cve[2]\.$cve[3] : "
-          . ( mysql_version_le( $cve[1], $cve[2], $cve[3] ) ? '<=' : > );
+          . ( mysql_version_le( $cve[1], $cve[2], $cve[3] ) ? '<=' : '>' );
 
         # Avoid not major/minor version corresponding CVEs
         next
@@ -1350,6 +1420,7 @@ sub get_process_memory {
 }
 
 sub get_other_process_memory {
+    return 0 if ( $opt{tbstat} == 0 );
     my @procs = `ps eaxo pid,command`;
     @procs = map {
         my $v = $_;
@@ -1372,10 +1443,10 @@ sub get_other_process_memory {
 sub get_os_release {
     if ( -f "/etc/lsb-release" ) {
         my @info_release = get_file_contents "/etc/lsb-release";
-        my $os_relase    = $info_release[3];
-        $os_relase =~ s/.*="//;
-        $os_relase =~ s/"$//;
-        return $os_relase;
+        my $os_release   = $info_release[3];
+        $os_release =~ s/.*="//;
+        $os_release =~ s/"$//;
+        return $os_release;
     }
 
     if ( -f "/etc/system-release" ) {
@@ -1385,17 +1456,17 @@ sub get_os_release {
 
     if ( -f "/etc/os-release" ) {
         my @info_release = get_file_contents "/etc/os-release";
-        my $os_relase    = $info_release[0];
-        $os_relase =~ s/.*="//;
-        $os_relase =~ s/"$//;
-        return $os_relase;
+        my $os_release   = $info_release[0];
+        $os_release =~ s/.*="//;
+        $os_release =~ s/"$//;
+        return $os_release;
     }
 
     if ( -f "/etc/issue" ) {
         my @info_release = get_file_contents "/etc/issue";
-        my $os_relase    = $info_release[0];
-        $os_relase =~ s/\s+\\n.*//;
-        return $os_relase;
+        my $os_release   = $info_release[0];
+        $os_release =~ s/\s+\\n.*//;
+        return $os_release;
     }
     return "Unknown OS release";
 }
@@ -1485,7 +1556,7 @@ sub infocmd_tab {
 
 sub infocmd_one {
     my $cmd    = "@_";
-    my @result = `$cmd`;
+    my @result = `$cmd 2>&1`;
     @result = remove_cr @result;
     return join ', ', @result;
 }
@@ -1576,6 +1647,7 @@ sub get_system_info {
     infoprint "Network Cards         : ";
     infocmd_tab "ifconfig| grep -A1 mtu";
     infoprint "Internal IP           : " . infocmd_one "hostname -I";
+    $result{'Network'}{'Internal Ip'} = `ifconfig| grep -A1 mtu`;
     my $httpcli = get_http_cli();
     infoprint "HTTP client found: $httpcli" if defined $httpcli;
 
@@ -1604,7 +1676,9 @@ sub get_system_info {
     infocmd_tab "top -n 1 -b | grep 'load average:'";
     $result{'OS'}{'Load Average'} = `top -n 1 -b | grep 'load average:'`;
 
-#infoprint "System Uptime Days/(HH:MM) : `uptime | awk '{print $3,$4}' | cut -f1 -d,`";
+    infoprint "System Uptime         : ";
+    infocmd_tab "uptime";
+    $result{'OS'}{'Uptime'} = `uptime`;
 }
 
 sub system_recommendations {
@@ -1683,14 +1757,29 @@ sub system_recommendations {
 
 sub security_recommendations {
     subheaderprint "Security Recommendations";
+
+    if ( mysql_version_eq(8) ) {
+        infoprint "Skipped due to unsupported feature for MySQL 8";
+        return;
+    }
+
+    #exit 0;
     if ( $opt{skippassword} eq 1 ) {
         infoprint "Skipped due to --skippassword option";
         return;
     }
 
     my $PASS_COLUMN_NAME = 'password';
-    if ( $myvar{'version'} =~ /5.7/ ) {
-        $PASS_COLUMN_NAME = 'authentication_string';
+    if ( $myvar{'version'} =~ /5\.7|10\..*MariaDB*/ ) {
+        my $password_column_exists =
+`$mysqlcmd $mysqllogin -Bse "SELECT 1 FROM information_schema.columns WHERE TABLE_SCHEMA = 'mysql' AND TABLE_NAME = 'user' AND COLUMN_NAME = 'password'" 2>>/dev/null`;
+        if ($password_column_exists) {
+            $PASS_COLUMN_NAME =
+"IF(plugin='mysql_native_password', authentication_string, password)";
+        }
+        else {
+            $PASS_COLUMN_NAME = 'authentication_string';
+        }
     }
     debugprint "Password column = $PASS_COLUMN_NAME";
 
@@ -1770,7 +1859,8 @@ sub security_recommendations {
     if (@mysqlstatlist) {
         foreach my $line ( sort @mysqlstatlist ) {
             chomp($line);
-            badprint "User '" . $line . "' hasn't specific host restriction.";
+            badprint "User '" . $line
+              . "' does not specify hostname restrictions.";
         }
         push( @generalrec,
             "Restrict Host for user\@% to user\@SpecificDNSorIp" );
@@ -1838,15 +1928,31 @@ sub get_replication_status {
           . scalar( keys %myslaves )
           . " server(s).";
     }
+    infoprint "Binlog format: " . $myvar{'binlog_format'};
+    infoprint "XA support enabled: " . $myvar{'innodb_support_xa'};
 
+    infoprint "Semi synchronous replication Master: "
+      . (
+        defined( $myvar{'rpl_semi_sync_master_enabled'} )
+        ? $myvar{'rpl_semi_sync_master_enabled'}
+        : 'Not Activated'
+      );
+    infoprint "Semi synchronous replication Slave: "
+      . (
+        defined( $myvar{'rpl_semi_sync_slave_enabled'} )
+        ? $myvar{'rpl_semi_sync_slave_enabled'}
+        : 'Not Activated'
+      );
     if ( scalar( keys %myrepl ) == 0 and scalar( keys %myslaves ) == 0 ) {
-        infoprint "This is a standalone server.";
+        infoprint "This is a standalone server";
         return;
     }
     if ( scalar( keys %myrepl ) == 0 ) {
-        infoprint "No replication setup for this server.";
+        infoprint
+          "No replication setup for this server or replication not started.";
         return;
     }
+
     $result{'Replication'}{'status'} = \%myrepl;
     my ($io_running) = $myrepl{'Slave_IO_Running'};
     debugprint "IO RUNNING: $io_running ";
@@ -1862,7 +1968,7 @@ sub get_replication_status {
           "This replication slave is not running but seems to be configured.";
     }
     if (   defined($io_running)
-        && $io_running  =~ /yes/i
+        && $io_running =~ /yes/i
         && $sql_running =~ /yes/i )
     {
         if ( $myvar{'read_only'} eq 'OFF' ) {
@@ -1888,21 +1994,34 @@ sub validate_mysql_version {
       $myvar{'version'} =~ /^(\d+)(?:\.(\d+)|)(?:\.(\d+)|)/;
     $mysqlverminor ||= 0;
     $mysqlvermicro ||= 0;
-    if ( !mysql_version_ge( 5, 1 ) ) {
+
+    if ( mysql_version_eq(8) or mysql_version_eq(5, 6) or mysql_version_eq(5, 7)
+        or mysql_version_eq(10, 1)  or mysql_version_eq(10, 2) or mysql_version_eq(10, 3)
+         or mysql_version_eq(10, 4) )
+    {
+        goodprint "Currently running supported MySQL version " . $myvar{'version'} . "";
+        return;
+    }
+    if ( mysql_version_ge( 5 ) or mysql_version_ge( 4 ) or mysql_version_eq(10, 0) ) {
         badprint "Your MySQL version "
           . $myvar{'version'}
           . " is EOL software!  Upgrade soon!";
     }
-    elsif ( ( mysql_version_ge(6) and mysql_version_le(9) )
-        or mysql_version_ge(12) )
-    {
-        badprint "Currently running unsupported MySQL version "
-          . $myvar{'version'} . "";
-    }
-    else {
-        goodprint "Currently running supported MySQL version "
-          . $myvar{'version'} . "";
-    }
+}
+
+# Checks if MySQL version is equal to (major, minor, micro)
+sub mysql_version_eq {
+    my ( $maj, $min, $mic ) = @_;
+    my ( $mysqlvermajor, $mysqlverminor, $mysqlvermicro ) =
+      $myvar{'version'} =~ /^(\d+)(?:\.(\d+)|)(?:\.(\d+)|)/;
+
+    return int($mysqlvermajor) == int($maj)
+      if ( !defined($min) && !defined($mic) );
+    return int($mysqlvermajor) == int($maj) && int($mysqlverminor) == int($min)
+      if ( !defined($mic) );
+    return ( int($mysqlvermajor) == int($maj)
+          && int($mysqlverminor) == int($min)
+          && int($mysqlvermicro) == int($mic) );
 }
 
 # Checks if MySQL version is greater than equal to (major, minor, micro)
@@ -1910,6 +2029,9 @@ sub mysql_version_ge {
     my ( $maj, $min, $mic ) = @_;
     $min ||= 0;
     $mic ||= 0;
+    my ( $mysqlvermajor, $mysqlverminor, $mysqlvermicro ) =
+      $myvar{'version'} =~ /^(\d+)(?:\.(\d+)|)(?:\.(\d+)|)/;
+
     return
          int($mysqlvermajor) > int($maj)
       || ( int($mysqlvermajor) == int($maj) && int($mysqlverminor) > int($min) )
@@ -1923,6 +2045,8 @@ sub mysql_version_le {
     my ( $maj, $min, $mic ) = @_;
     $min ||= 0;
     $mic ||= 0;
+    my ( $mysqlvermajor, $mysqlverminor, $mysqlvermicro ) =
+      $myvar{'version'} =~ /^(\d+)(?:\.(\d+)|)(?:\.(\d+)|)/;
     return
          int($mysqlvermajor) < int($maj)
       || ( int($mysqlvermajor) == int($maj) && int($mysqlverminor) < int($min) )
@@ -1934,6 +2058,9 @@ sub mysql_version_le {
 # Checks if MySQL micro version is lower than equal to (major, minor, micro)
 sub mysql_micro_version_le {
     my ( $maj, $min, $mic ) = @_;
+    my ( $mysqlvermajor, $mysqlverminor, $mysqlvermicro ) =
+      $myvar{'version'} =~ /^(\d+)(?:\.(\d+)|)(?:\.(\d+)|)/;
+
     return $mysqlvermajor == $maj
       && ( $mysqlverminor == $min
         && $mysqlvermicro <= $mic );
@@ -1948,7 +2075,7 @@ sub check_architecture {
         $arch = 64;
         goodprint "Operating on 64-bit architecture";
     }
-    elsif ( `uname` !~ /SunOS/ && `uname -m` =~ /64/ ) {
+    elsif ( `uname` !~ /SunOS/ && `uname -m` =~ /(64|s390x)/ ) {
         $arch = 64;
         goodprint "Operating on 64-bit architecture";
     }
@@ -1994,12 +2121,11 @@ sub check_architecture {
 my ( %enginestats, %enginecount, $fragtables );
 
 sub check_storage_engines {
+    subheaderprint "Storage Engine Statistics";
     if ( $opt{skipsize} eq 1 ) {
-        subheaderprint "Storage Engine Statistics";
         infoprint "Skipped due to --skipsize option";
         return;
     }
-    subheaderprint "Storage Engine Statistics";
 
     my $engines;
     if ( mysql_version_ge( 5, 5 ) ) {
@@ -2130,7 +2256,7 @@ sub check_storage_engines {
             debugprint "Data dump " . Dumper(@$tbl);
             my ( $engine, $size, $datafree ) = @$tbl;
             next if $engine eq 'NULL';
-            $size     = 0 if $size     eq 'NULL';
+            $size     = 0 if $size eq 'NULL';
             $datafree = 0 if $datafree eq 'NULL';
             if ( defined $enginestats{$engine} ) {
                 $enginestats{$engine} += $size;
@@ -2147,7 +2273,7 @@ sub check_storage_engines {
     }
     while ( my ( $engine, $size ) = each(%enginestats) ) {
         infoprint "Data in $engine tables: "
-          . hr_bytes_rnd($size)
+          . hr_bytes($size)
           . " (Tables: "
           . $enginecount{$engine} . ")" . "";
     }
@@ -2309,22 +2435,24 @@ sub calculations {
 
 # Global memory
 # Max used memory is memory used by MySQL based on Max_used_connections
-# This is the max memory used theorically calculated with the max concurrent connection number reached by mysql
+# This is the max memory used theoretically calculated with the max concurrent connection number reached by mysql
     $mycalc{'max_used_memory'} =
       $mycalc{'server_buffers'} +
       $mycalc{"max_total_per_thread_buffers"} +
-      get_pf_memory() +
-      get_gcache_memory();
+      get_pf_memory();
+
+    #   + get_gcache_memory();
     $mycalc{'pct_max_used_memory'} =
       percentage( $mycalc{'max_used_memory'}, $physical_memory );
 
 # Total possible memory is memory needed by MySQL based on max_connections
-# This is the max memory MySQL can theorically used if all connections allowed has opened by mysql
+# This is the max memory MySQL can theoretically used if all connections allowed has opened by mysql
     $mycalc{'max_peak_memory'} =
       $mycalc{'server_buffers'} +
       $mycalc{'total_per_thread_buffers'} +
-      get_pf_memory() +
-      get_gcache_memory();
+      get_pf_memory();
+
+    # +  get_gcache_memory();
     $mycalc{'pct_max_physical_memory'} =
       percentage( $mycalc{'max_peak_memory'}, $physical_memory );
 
@@ -2369,7 +2497,7 @@ sub calculations {
                           $myvar{'key_cache_block_size'}
                     ) / $myvar{'key_buffer_size'}
                 )
-              ) * 100
+            ) * 100
         );
     }
     else {
@@ -2450,20 +2578,23 @@ sub calculations {
     }
 
     # Query cache
-    if ( mysql_version_ge(4) ) {
+    if ( mysql_version_ge(8) and mysql_version_le(10) ) {
+        $mycalc{'query_cache_efficiency'} = 0;
+    }
+    elsif ( mysql_version_ge(4) ) {
         $mycalc{'query_cache_efficiency'} = sprintf(
             "%.1f",
             (
                 $mystat{'Qcache_hits'} /
                   ( $mystat{'Com_select'} + $mystat{'Qcache_hits'} )
-              ) * 100
+            ) * 100
         );
         if ( $myvar{'query_cache_size'} ) {
             $mycalc{'pct_query_cache_used'} = sprintf(
                 "%.1f",
                 100 - (
                     $mystat{'Qcache_free_memory'} / $myvar{'query_cache_size'}
-                  ) * 100
+                ) * 100
             );
         }
         if ( $mystat{'Qcache_lowmem_prunes'} == 0 ) {
@@ -2574,7 +2705,7 @@ sub calculations {
               $myvar{'innodb_buffer_pool_size'} );
     }
 
-    # InnoDB Buffer pool read cache effiency
+    # InnoDB Buffer pool read cache efficiency
     (
         $mystat{'Innodb_buffer_pool_read_requests'},
         $mystat{'Innodb_buffer_pool_reads'}
@@ -2594,7 +2725,7 @@ sub calculations {
     debugprint "Innodb_buffer_pool_read_requests: "
       . $mystat{'Innodb_buffer_pool_read_requests'} . "";
 
-    # InnoDB log write cache effiency
+    # InnoDB log write cache efficiency
     ( $mystat{'Innodb_log_write_requests'}, $mystat{'Innodb_log_writes'} ) =
       ( 1, 1 )
       unless defined $mystat{'Innodb_log_writes'};
@@ -2631,7 +2762,7 @@ sub mysql_stats {
         $qps = sprintf( "%.3f", $mystat{'Questions'} / $mystat{'Uptime'} );
     }
     push( @generalrec,
-        "MySQL started within last 24 hours - recommendations may be inaccurate"
+"MySQL was started within the last 24 hours - recommendations may be inaccurate"
     ) if ( $mystat{'Uptime'} < 86400 );
     infoprint "Up for: "
       . pretty_uptime( $mystat{'Uptime'} ) . " ("
@@ -2662,17 +2793,15 @@ sub mysql_stats {
     infoprint "Max MySQL memory    : " . hr_bytes( $mycalc{'max_peak_memory'} );
     infoprint "Other process memory: " . hr_bytes( get_other_process_memory() );
 
-    #print hr_bytes( $mycalc{'server_buffers'} );
-
     infoprint "Total buffers: "
       . hr_bytes( $mycalc{'server_buffers'} )
       . " global + "
       . hr_bytes( $mycalc{'per_thread_buffers'} )
       . " per thread ($myvar{'max_connections'} max threads)";
     infoprint "P_S Max memory usage: " . hr_bytes_rnd( get_pf_memory() );
-    $result{'P_S'}{'memory'} = get_other_process_memory();
+    $result{'P_S'}{'memory'} = get_pf_memory();
     $result{'P_S'}{'pretty_memory'} =
-      hr_bytes_rnd( get_other_process_memory() );
+      hr_bytes_rnd( get_pf_memory() );
     infoprint "Galera GCache Max memory usage: "
       . hr_bytes_rnd( get_gcache_memory() );
     $result{'Galera'}{'GCache'}{'memory'} = get_gcache_memory();
@@ -2844,6 +2973,11 @@ sub mysql_stats {
         push( @generalrec,
             "Upgrade MySQL to version 4+ to utilize query caching" );
     }
+    elsif ( mysql_version_eq(8) ) {
+        infoprint "Query cache have been removed in MySQL 8";
+
+        #return;
+    }
     elsif ( $myvar{'query_cache_size'} < 1
         and $myvar{'query_cache_type'} eq "OFF" )
     {
@@ -2940,7 +3074,7 @@ sub mysql_stats {
         push( @adjvars,
                 "join_buffer_size (> "
               . hr_bytes( $myvar{'join_buffer_size'} )
-              . ", or always use indexes with joins)" );
+              . ", or always use indexes with JOINs)" );
         push( @generalrec,
             "Adjust your join queries to always utilize indexes" );
     }
@@ -3005,16 +3139,20 @@ sub mysql_stats {
     }
 
     # Thread cache
-    if ( $myvar{'thread_cache_size'} eq 0 ) {
-        badprint "Thread cache is disabled";
-        push( @generalrec, "Set thread_cache_size to 4 as a starting value" );
-        push( @adjvars,    "thread_cache_size (start at 4)" );
+    if ( defined( $myvar{'thread_handling'} )
+        and $myvar{'thread_handling'} eq 'pool-of-threads' )
+    {
+ # https://www.percona.com/doc/percona-server/LATEST/performance/threadpool.html
+ # When thread pool is enabled, the value of the thread_cache_size variable
+ # is ignored. The Threads_cached status variable contains 0 in this case.
+        infoprint "Thread cache not used with thread_handling=pool-of-threads";
     }
     else {
-        if ( defined( $myvar{'thread_handling'} )
-            and $myvar{'thread_handling'} eq 'pools-of-threads' )
-        {
-            infoprint "Thread cache hit rate: not used with pool-of-threads";
+        if ( $myvar{'thread_cache_size'} eq 0 ) {
+            badprint "Thread cache is disabled";
+            push( @generalrec,
+                "Set thread_cache_size to 4 as a starting value" );
+            push( @adjvars, "thread_cache_size (start at 4)" );
         }
         else {
             if ( $mycalc{'thread_cache_hit_rate'} <= 50 ) {
@@ -3063,7 +3201,20 @@ sub mysql_stats {
             push( @generalrec,
                     "Read this before increasing "
                   . $table_cache_var
-                  . " over 64: http://bit.ly/1mi7c4C" );
+                  . " over 64: https://bit.ly/1mi7c4C" );
+            push( @generalrec,
+                    "Read this before increasing for MariaDB"
+                  . " https://mariadb.com/kb/en/library/optimizing-table_open_cache/"
+            );
+            push( @generalrec,
+"This is MyISAM only table_cache scalability problem, InnoDB not affected."
+            );
+            push( @generalrec,
+                "See more details here: https://bugs.mysql.com/bug.php?id=49177"
+            );
+            push( @generalrec,
+"This bug already fixed in MySQL 5.7.9 and newer MySQL versions."
+            );
             push( @generalrec,
                     "Beware that open_files_limit ("
                   . $myvar{'open_files_limit'}
@@ -3166,7 +3317,10 @@ sub mysql_stats {
 # Recommendations for MyISAM
 sub mysql_myisam {
     subheaderprint "MyISAM Metrics";
-
+    if (mysql_version_ge(8) and mysql_version_le(10) ) {
+        infoprint "MyISAM Metrics are disabled on last MySQL versions.";
+        return;
+    }
     # Key buffer usage
     if ( defined( $mycalc{'pct_key_buffer_used'} ) ) {
         if ( $mycalc{'pct_key_buffer_used'} < 90 ) {
@@ -3370,14 +3524,15 @@ sub mysqsl_pfs {
         infoprint "Performance schema is disabled.";
         if ( mysql_version_ge( 5, 6 ) ) {
             push( @generalrec,
-                "Performance should be activated for better diagnostics" );
+                "Performance schema should be activated for better diagnostics"
+            );
             push( @adjvars, "performance_schema = ON enable PFS" );
         }
     }
     else {
         if ( mysql_version_le( 5, 5 ) ) {
             push( @generalrec,
-"Performance shouldn't be activated for MySQL and MariaDB 5.5 and lower version"
+"Performance schema shouldn't be activated for MySQL and MariaDB 5.5 and lower version"
             );
             push( @adjvars, "performance_schema = OFF disable PFS" );
         }
@@ -3385,11 +3540,22 @@ sub mysqsl_pfs {
     debugprint "Performance schema is " . $myvar{'performance_schema'};
     infoprint "Memory used by P_S: " . hr_bytes( get_pf_memory() );
 
+    if ( mysql_version_eq( 10, 0 ) ) {
+        push( @generalrec,
+"Performance schema shouldn't be activated for MariaDB 10.0 for performance issue"
+        );
+        push( @adjvars, "performance_schema = OFF disable PFS" );
+        return;
+    }
     unless ( grep /^sys$/, select_array("SHOW DATABASES") ) {
         infoprint "Sys schema isn't installed.";
         push( @generalrec,
-"Consider installing Sys schema from https://github.com/mysql/mysql-sys"
-        ) unless ( mysql_version_le( 5, 5 ) );
+"Consider installing Sys schema from https://github.com/mysql/mysql-sys for MySQL"
+        ) unless ( mysql_version_le( 5, 6 ) );
+        push( @generalrec,
+"Consider installing Sys schema from https://github.com/good-dba/mariadb-sys for MariaDB"
+        ) unless ( mysql_version_eq( 10, 0 ) or mysql_version_eq( 5, 5 ) );
+
         return;
     }
     else {
@@ -3412,7 +3578,7 @@ sub mysqsl_pfs {
         infoprint " +-- $nbL: $lQuery conn(s)";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     # Top user per statement
@@ -3427,7 +3593,7 @@ sub mysqsl_pfs {
         infoprint " +-- $nbL: $lQuery stmt(s)";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     # Top user per statement latency
@@ -3435,14 +3601,14 @@ sub mysqsl_pfs {
     $nbL = 1;
     for my $lQuery (
         select_array(
-'select user, statement_avg_latency from sys.user_summary order by statement_avg_latency desc LIMIT 5'
+'select user, statement_avg_latency from sys.x\\$user_summary order by statement_avg_latency desc LIMIT 5'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     # Top user per lock latency
@@ -3450,14 +3616,14 @@ sub mysqsl_pfs {
     $nbL = 1;
     for my $lQuery (
         select_array(
-'select user, lock_latency from sys.user_summary_by_statement_latency order by lock_latency desc LIMIT 5'
+'select user, lock_latency from sys.x\\$user_summary_by_statement_latency order by lock_latency desc LIMIT 5'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     # Top user per full scans
@@ -3465,14 +3631,14 @@ sub mysqsl_pfs {
     $nbL = 1;
     for my $lQuery (
         select_array(
-'select user, full_scans from sys.user_summary_by_statement_latency order by full_scans desc LIMIT 5'
+'select user, full_scans from sys.x\\$user_summary_by_statement_latency order by full_scans desc LIMIT 5'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     # Top user per row_sent
@@ -3480,14 +3646,14 @@ sub mysqsl_pfs {
     $nbL = 1;
     for my $lQuery (
         select_array(
-'select user, rows_sent from sys.user_summary_by_statement_latency order by rows_sent desc LIMIT 5'
+'select user, rows_sent from sys.x\\$user_summary_by_statement_latency order by rows_sent desc LIMIT 5'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     # Top user per row modified
@@ -3495,14 +3661,14 @@ sub mysqsl_pfs {
     $nbL = 1;
     for my $lQuery (
         select_array(
-'select user, rows_affected from sys.user_summary_by_statement_latency order by rows_affected desc LIMIT 5'
+'select user, rows_affected from sys.x\\$user_summary_by_statement_latency order by rows_affected desc LIMIT 5'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     # Top user per io
@@ -3510,14 +3676,14 @@ sub mysqsl_pfs {
     $nbL = 1;
     for my $lQuery (
         select_array(
-'select user, file_ios from sys.user_summary order by file_ios desc LIMIT 5'
+'select user, file_ios from sys.x\\$user_summary order by file_ios desc LIMIT 5'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     # Top user per io latency
@@ -3525,14 +3691,14 @@ sub mysqsl_pfs {
     $nbL = 1;
     for my $lQuery (
         select_array(
-'select user, file_io_latency from sys.user_summary order by file_io_latency desc LIMIT 5'
+'select user, file_io_latency from sys.x\\$user_summary order by file_io_latency desc LIMIT 5'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     # Top host per connection
@@ -3540,14 +3706,14 @@ sub mysqsl_pfs {
     $nbL = 1;
     for my $lQuery (
         select_array(
-'select host, total_connections from sys.host_summary order by total_connections desc LIMIT 5'
+'select host, total_connections from sys.x\\$host_summary order by total_connections desc LIMIT 5'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery conn(s)";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     # Top host per statement
@@ -3555,14 +3721,14 @@ sub mysqsl_pfs {
     $nbL = 1;
     for my $lQuery (
         select_array(
-'select host, statements from sys.host_summary order by statements desc LIMIT 5'
+'select host, statements from sys.x\\$host_summary order by statements desc LIMIT 5'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery stmt(s)";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     # Top host per statement latency
@@ -3570,14 +3736,14 @@ sub mysqsl_pfs {
     $nbL = 1;
     for my $lQuery (
         select_array(
-'select host, statement_avg_latency from sys.host_summary order by statement_avg_latency desc LIMIT 5'
+'select host, statement_avg_latency from sys.x\\$host_summary order by statement_avg_latency desc LIMIT 5'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     # Top host per lock latency
@@ -3585,14 +3751,14 @@ sub mysqsl_pfs {
     $nbL = 1;
     for my $lQuery (
         select_array(
-'select host, lock_latency from sys.host_summary_by_statement_latency order by lock_latency desc LIMIT 5'
+'select host, lock_latency from sys.x\\$host_summary_by_statement_latency order by lock_latency desc LIMIT 5'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     # Top host per full scans
@@ -3600,14 +3766,14 @@ sub mysqsl_pfs {
     $nbL = 1;
     for my $lQuery (
         select_array(
-'select host, full_scans from sys.host_summary_by_statement_latency order by full_scans desc LIMIT 5'
+'select host, full_scans from sys.x\\$host_summary_by_statement_latency order by full_scans desc LIMIT 5'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     # Top host per rows sent
@@ -3615,14 +3781,14 @@ sub mysqsl_pfs {
     $nbL = 1;
     for my $lQuery (
         select_array(
-'select host, rows_sent from sys.host_summary_by_statement_latency order by rows_sent desc LIMIT 5'
+'select host, rows_sent from sys.x\\$host_summary_by_statement_latency order by rows_sent desc LIMIT 5'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     # Top host per rows modified
@@ -3630,14 +3796,14 @@ sub mysqsl_pfs {
     $nbL = 1;
     for my $lQuery (
         select_array(
-'select host, rows_affected from sys.host_summary_by_statement_latency order by rows_affected desc LIMIT 5'
+'select host, rows_affected from sys.x\\$host_summary_by_statement_latency order by rows_affected desc LIMIT 5'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     # Top host per io
@@ -3645,14 +3811,14 @@ sub mysqsl_pfs {
     $nbL = 1;
     for my $lQuery (
         select_array(
-'select host, file_ios from sys.host_summary order by file_ios desc LIMIT 5'
+'select host, file_ios from sys.x\\$host_summary order by file_ios desc LIMIT 5'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     # Top 5 host per io latency
@@ -3660,14 +3826,14 @@ sub mysqsl_pfs {
     $nbL = 1;
     for my $lQuery (
         select_array(
-'select host, file_io_latency from sys.host_summary order by file_io_latency desc LIMIT 5'
+'select host, file_io_latency from sys.x\\$host_summary order by file_io_latency desc LIMIT 5'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     # Top IO type order by total io
@@ -3675,14 +3841,14 @@ sub mysqsl_pfs {
     $nbL = 1;
     for my $lQuery (
         select_array(
-'use sys;select substring(event_name,14), SUM(total)AS total from sys.host_summary_by_file_io_type GROUP BY substring(event_name,14) ORDER BY total DESC;'
+'use sys;select substring(event_name,14), SUM(total)AS total from sys.x\\$host_summary_by_file_io_type GROUP BY substring(event_name,14) ORDER BY total DESC;'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery i/o";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     # Top IO type order by total latency
@@ -3690,14 +3856,14 @@ sub mysqsl_pfs {
     $nbL = 1;
     for my $lQuery (
         select_array(
-'use sys;select substring(event_name,14), format_time(ROUND(SUM(total_latency),1)) AS total_latency from sys.host_summary_by_file_io_type GROUP BY substring(event_name,14) ORDER BY total_latency DESC;'
+'select substring(event_name,14), ROUND(SUM(total_latency),1) AS total_latency from sys.x\\$host_summary_by_file_io_type GROUP BY substring(event_name,14) ORDER BY total_latency DESC;'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     # Top IO type order by max latency
@@ -3705,14 +3871,14 @@ sub mysqsl_pfs {
     $nbL = 1;
     for my $lQuery (
         select_array(
-'use sys;select substring(event_name,14), MAX(max_latency) as max_latency from sys.host_summary_by_file_io_type GROUP BY substring(event_name,14) ORDER BY max_latency DESC;'
+'use sys;select substring(event_name,14), MAX(max_latency) as max_latency from sys.x\\$host_summary_by_file_io_type GROUP BY substring(event_name,14) ORDER BY max_latency DESC;'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     # Top Stages order by total io
@@ -3720,14 +3886,14 @@ sub mysqsl_pfs {
     $nbL = 1;
     for my $lQuery (
         select_array(
-'use sys;select substring(event_name,7), SUM(total)AS total from sys.host_summary_by_stages GROUP BY substring(event_name,7) ORDER BY total DESC;'
+'use sys;select substring(event_name,7), SUM(total)AS total from sys.x\\$host_summary_by_stages GROUP BY substring(event_name,7) ORDER BY total DESC;'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery i/o";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     # Top Stages order by total latency
@@ -3735,14 +3901,14 @@ sub mysqsl_pfs {
     $nbL = 1;
     for my $lQuery (
         select_array(
-'use sys;select substring(event_name,7), format_time(ROUND(SUM(total_latency),1)) AS total_latency from sys.host_summary_by_stages GROUP BY substring(event_name,7) ORDER BY total_latency DESC;'
+'use sys;select substring(event_name,7), ROUND(SUM(total_latency),1) AS total_latency from sys.x\\$host_summary_by_stages GROUP BY substring(event_name,7) ORDER BY total_latency DESC;'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     # Top Stages order by avg latency
@@ -3750,14 +3916,14 @@ sub mysqsl_pfs {
     $nbL = 1;
     for my $lQuery (
         select_array(
-'use sys;select substring(event_name,7), MAX(avg_latency) as avg_latency from sys.host_summary_by_stages GROUP BY substring(event_name,7) ORDER BY avg_latency DESC;'
+'use sys;select substring(event_name,7), MAX(avg_latency) as avg_latency from sys.x\\$host_summary_by_stages GROUP BY substring(event_name,7) ORDER BY avg_latency DESC;'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     # Top host per table scans
@@ -3765,14 +3931,14 @@ sub mysqsl_pfs {
     $nbL = 1;
     for my $lQuery (
         select_array(
-'select host, table_scans from sys.host_summary order by table_scans desc LIMIT 5'
+'select host, table_scans from sys.x\\$host_summary order by table_scans desc LIMIT 5'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     # InnoDB Buffer Pool by schema
@@ -3780,44 +3946,44 @@ sub mysqsl_pfs {
     $nbL = 1;
     for my $lQuery (
         select_array(
-'select object_schema, allocated, data, pages from sys.innodb_buffer_stats_by_schema ORDER BY pages DESC'
+'select object_schema, allocated, data, pages from sys.x\\$innodb_buffer_stats_by_schema ORDER BY pages DESC'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery page(s)";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     # InnoDB Buffer Pool by table
-    subheaderprint "Performance schema: InnoDB Buffer Pool by table";
+    subheaderprint "Performance schema: 40 InnoDB Buffer Pool by table";
     $nbL = 1;
     for my $lQuery (
         select_array(
-"select CONCAT(object_schema,CONCAT('.', object_name)), allocated,data, pages from sys.innodb_buffer_stats_by_table ORDER BY pages DESC"
+'select object_schema,  object_name, allocated,data, pages from sys.x\\$innodb_buffer_stats_by_table ORDER BY pages DESC LIMIT 40'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery page(s)";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     # Process per allocated memory
-    subheaderprint "Performance schema: Process per allocated memory";
+    subheaderprint "Performance schema: Process per time";
     $nbL = 1;
     for my $lQuery (
         select_array(
-"select concat(user,concat('/', IFNULL(Command,'NONE'))) AS PROC, current_memory from sys.processlist ORDER BY current_memory DESC;"
+'select user, Command AS PROC, time from sys.x\\$processlist ORDER BY time DESC;'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     # InnoDB Lock Waits
@@ -3825,14 +3991,14 @@ sub mysqsl_pfs {
     $nbL = 1;
     for my $lQuery (
         select_array(
-"use sys;select wait_age_secs, locked_table, locked_type, waiting_query from innodb_lock_waits order by wait_age_secs DESC;"
+'select wait_age_secs, locked_table, locked_type, waiting_query from sys.x\\$innodb_lock_waits order by wait_age_secs DESC;'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     # Threads IO Latency
@@ -3840,159 +4006,159 @@ sub mysqsl_pfs {
     $nbL = 1;
     for my $lQuery (
         select_array(
-"use sys;select user, total_latency, max_latency from io_by_thread_by_latency order by total_latency;"
+'select user, total_latency, max_latency from sys.x\\$io_by_thread_by_latency order by total_latency DESC;'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     # High Cost SQL statements
-    subheaderprint "Performance schema: Top 5 Most latency statements";
+    subheaderprint "Performance schema: Top 15 Most latency statements";
     $nbL = 1;
     for my $lQuery (
         select_array(
-'select query, avg_latency from sys.statement_analysis order by avg_latency desc LIMIT 5'
+'select LEFT(query, 120), avg_latency from sys.x\\$statement_analysis order by avg_latency desc LIMIT 15'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     # Top 5% slower queries
-    subheaderprint "Performance schema: Top 5 slower queries";
+    subheaderprint "Performance schema: Top 15 slower queries";
     $nbL = 1;
     for my $lQuery (
         select_array(
-'select query, exec_count from sys.statements_with_runtimes_in_95th_percentile order by exec_count desc LIMIT 5'
+'select LEFT(query, 120), exec_count from sys.x\\$statements_with_runtimes_in_95th_percentile order by exec_count desc LIMIT 15'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery s";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     # Top 10 nb statement type
-    subheaderprint "Performance schema: Top 10 nb statement type";
+    subheaderprint "Performance schema: Top 15 nb statement type";
     $nbL = 1;
     for my $lQuery (
         select_array(
-'use sys;select statement, sum(total) as total from host_summary_by_statement_type group by statement order by total desc LIMIT 10;'
+'use sys;select statement, sum(total) as total from sys.x\\$host_summary_by_statement_type group by statement order by total desc LIMIT 15;'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     # Top statement by total latency
-    subheaderprint "Performance schema: Top statement by total latency";
+    subheaderprint "Performance schema: Top 15 statement by total latency";
     $nbL = 1;
     for my $lQuery (
         select_array(
-'use sys;select statement, sum(total_latency) as total from sys.host_summary_by_statement_type group by statement order by total desc LIMIT 10;'
+'use sys;select statement, sum(total_latency) as total from sys.x\\$host_summary_by_statement_type group by statement order by total desc LIMIT 15;'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     # Top statement by lock latency
-    subheaderprint "Performance schema: Top statement by lock latency";
+    subheaderprint "Performance schema: Top 15 statement by lock latency";
     $nbL = 1;
     for my $lQuery (
         select_array(
-'use sys;select statement, sum(lock_latency) as total from sys.host_summary_by_statement_type group by statement order by total desc LIMIT 10;'
+'use sys;select statement, sum(lock_latency) as total from sys.x\\$host_summary_by_statement_type group by statement order by total desc LIMIT 15;'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     # Top statement by full scans
-    subheaderprint "Performance schema: Top statement by full scans";
+    subheaderprint "Performance schema: Top 15 statement by full scans";
     $nbL = 1;
     for my $lQuery (
         select_array(
-'use sys;select statement, sum(full_scans) as total from sys.host_summary_by_statement_type group by statement order by total desc LIMIT 10;'
+'use sys;select statement, sum(full_scans) as total from sys.x\\$host_summary_by_statement_type group by statement order by total desc LIMIT 15;'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     # Top statement by rows sent
-    subheaderprint "Performance schema: Top statement by rows sent";
+    subheaderprint "Performance schema: Top 15 statement by rows sent";
     $nbL = 1;
     for my $lQuery (
         select_array(
-'use sys;select statement, sum(rows_sent) as total from sys.host_summary_by_statement_type group by statement order by total desc LIMIT 10;'
+'use sys;select statement, sum(rows_sent) as total from sys.x\\$host_summary_by_statement_type group by statement order by total desc LIMIT 15;'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     # Top statement by rows modified
-    subheaderprint "Performance schema: Top statement by rows modified";
+    subheaderprint "Performance schema: Top 15 statement by rows modified";
     $nbL = 1;
     for my $lQuery (
         select_array(
-'use sys;select statement, sum(rows_affected) as total from sys.host_summary_by_statement_type group by statement order by total desc LIMIT 10;'
+'use sys;select statement, sum(rows_affected) as total from sys.x\\$host_summary_by_statement_type group by statement order by total desc LIMIT 15;'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     # Use temporary tables
-    subheaderprint "Performance schema: Some queries using temp table";
+    subheaderprint "Performance schema: 15 sample queries using temp table";
     $nbL = 1;
     for my $lQuery (
         select_array(
-            'use sys;select query from sys.statements_with_temp_tables LIMIT 20'
+'use sys;select left(query, 120) from sys.x\\$statements_with_temp_tables LIMIT 15'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     # Unused Indexes
     subheaderprint "Performance schema: Unused indexes";
     $nbL = 1;
-    for my $lQuery ( select_array('select * from sys.schema_unused_indexes') ) {
+    for my $lQuery ( select_array("select \* from sys.schema_unused_indexes where object_schema not in ('performance_schema')" )) {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     # Full table scans
@@ -4000,14 +4166,14 @@ sub mysqsl_pfs {
     $nbL = 1;
     for my $lQuery (
         select_array(
-'select * from sys.schema_tables_with_full_table_scans order by rows_full_scanned DESC'
+'select * from sys.x\\$schema_tables_with_full_table_scans order by rows_full_scanned DESC'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     # Latest file IO by latency
@@ -4015,14 +4181,14 @@ sub mysqsl_pfs {
     $nbL = 1;
     for my $lQuery (
         select_array(
-'use sys;select thread, file, latency, operation from latest_file_io ORDER BY latency LIMIT 10;'
+'use sys;select thread, file, latency, operation from sys.x\\$latest_file_io ORDER BY latency LIMIT 10;'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     # FILE by IO read bytes
@@ -4030,14 +4196,14 @@ sub mysqsl_pfs {
     $nbL = 1;
     for my $lQuery (
         select_array(
-"use sys;(select file, total_read from io_global_by_file_by_bytes where total_read like '%MiB' order by total_read DESC) UNION (select file, total_read from io_global_by_file_by_bytes where total_read like '%KiB' order by total_read DESC LIMIT 15);"
+'select file, total_read from sys.x\\$io_global_by_file_by_bytes order by total_read DESC LIMIT 15;'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     # FILE by IO written bytes
@@ -4045,14 +4211,14 @@ sub mysqsl_pfs {
     $nbL = 1;
     for my $lQuery (
         select_array(
-"use sys;(select file, total_written from io_global_by_file_by_bytes where total_written like '%MiB' order by total_written DESC) UNION (select file, total_written from io_global_by_file_by_bytes where total_written like '%KiB' order by total_written DESC LIMIT 15);"
+'select file, total_written from sys.x\\$io_global_by_file_by_bytes order by total_written DESC LIMIT 15'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     # file per IO total latency
@@ -4060,14 +4226,14 @@ sub mysqsl_pfs {
     $nbL = 1;
     for my $lQuery (
         select_array(
-'use sys;select file, total_latency from io_global_by_file_by_latency ORDER BY total_latency DESC LIMIT 20;'
+'select file, total_latency from sys.x\\$io_global_by_file_by_latency ORDER BY total_latency DESC LIMIT 20;'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     # file per IO read latency
@@ -4075,14 +4241,14 @@ sub mysqsl_pfs {
     $nbL = 1;
     for my $lQuery (
         select_array(
-'use sys;select file, read_latency from io_global_by_file_by_latency ORDER BY read_latency DESC LIMIT 20;'
+'use sys;select file, read_latency from sys.x\\$io_global_by_file_by_latency ORDER BY read_latency DESC LIMIT 20;'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     # file per IO write latency
@@ -4090,14 +4256,14 @@ sub mysqsl_pfs {
     $nbL = 1;
     for my $lQuery (
         select_array(
-'use sys;select file, write_latency from io_global_by_file_by_latency ORDER BY write_latency DESC LIMIT 20;'
+'use sys;select file, write_latency from sys.x\\$io_global_by_file_by_latency ORDER BY write_latency DESC LIMIT 20;'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     # Event Wait by read bytes
@@ -4105,14 +4271,14 @@ sub mysqsl_pfs {
     $nbL = 1;
     for my $lQuery (
         select_array(
-"use sys;(select event_name, total_read from io_global_by_wait_by_bytes where total_read like '%MiB' order by total_read DESC) UNION (select event_name, total_read from io_global_by_wait_by_bytes where total_read like '%KiB' order by total_read DESC LIMIT 15);"
+'select event_name, total_read from sys.x\\$io_global_by_wait_by_bytes order by total_read DESC LIMIT 15;'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     # Event Wait by write bytes
@@ -4120,14 +4286,14 @@ sub mysqsl_pfs {
     $nbL = 1;
     for my $lQuery (
         select_array(
-"use sys;(select event_name, total_written from io_global_by_wait_by_bytes where total_written like '%MiB' order by total_written DESC) UNION (select event_name, total_written from io_global_by_wait_by_bytes where total_written like '%KiB' order by total_written DESC LIMIT 15);"
+'select event_name, total_written from sys.x\\$io_global_by_wait_by_bytes order by total_written DESC LIMIT 15;'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     # event per wait total latency
@@ -4135,14 +4301,14 @@ sub mysqsl_pfs {
     $nbL = 1;
     for my $lQuery (
         select_array(
-'use sys;select event_name, total_latency from io_global_by_wait_by_latency ORDER BY total_latency DESC LIMIT 20;'
+'use sys;select event_name, total_latency from sys.x\\$io_global_by_wait_by_latency ORDER BY total_latency DESC LIMIT 20;'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     # event per wait read latency
@@ -4150,14 +4316,14 @@ sub mysqsl_pfs {
     $nbL = 1;
     for my $lQuery (
         select_array(
-'use sys;select event_name, read_latency from io_global_by_wait_by_latency ORDER BY read_latency DESC LIMIT 20;'
+'use sys;select event_name, read_latency from sys.x\\$io_global_by_wait_by_latency ORDER BY read_latency DESC LIMIT 20;'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     # event per wait write latency
@@ -4165,14 +4331,14 @@ sub mysqsl_pfs {
     $nbL = 1;
     for my $lQuery (
         select_array(
-'use sys;select event_name, write_latency from io_global_by_wait_by_latency ORDER BY write_latency DESC LIMIT 20;'
+'use sys;select event_name, write_latency from sys.x\\$io_global_by_wait_by_latency ORDER BY write_latency DESC LIMIT 20;'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     #schema_index_statistics
@@ -4181,14 +4347,14 @@ sub mysqsl_pfs {
     $nbL = 1;
     for my $lQuery (
         select_array(
-'use sys;select table_schema, table_name,index_name, rows_selected from schema_index_statistics ORDER BY ROWs_selected DESC LIMIT 15;'
+'use sys;select table_schema, table_name,index_name, rows_selected from sys.x\\$schema_index_statistics ORDER BY ROWs_selected DESC LIMIT 15;'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     # TOP 15 most used index
@@ -4196,14 +4362,14 @@ sub mysqsl_pfs {
     $nbL = 1;
     for my $lQuery (
         select_array(
-'use sys;select table_schema, table_name,index_name, rows_inserted+rows_updated+rows_deleted AS changes from schema_index_statistics ORDER BY rows_inserted+rows_updated+rows_deleted DESC LIMIT 15;'
+'use sys;select table_schema, table_name,index_name, rows_inserted+rows_updated+rows_deleted AS changes from sys.x\\$schema_index_statistics ORDER BY rows_inserted+rows_updated+rows_deleted DESC LIMIT 15;'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     # TOP 15 high read latency index
@@ -4211,14 +4377,14 @@ sub mysqsl_pfs {
     $nbL = 1;
     for my $lQuery (
         select_array(
-'use sys;select table_schema, table_name,index_name, select_latency from schema_index_statistics ORDER BY select_latency DESC LIMIT 15;'
+'use sys;select table_schema, table_name,index_name, select_latency from sys.x\\$schema_index_statistics ORDER BY select_latency DESC LIMIT 15;'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     # TOP 15 high insert latency index
@@ -4226,14 +4392,14 @@ sub mysqsl_pfs {
     $nbL = 1;
     for my $lQuery (
         select_array(
-'use sys;select table_schema, table_name,index_name, insert_latency from schema_index_statistics ORDER BY insert_latency DESC LIMIT 15;'
+'use sys;select table_schema, table_name,index_name, insert_latency from sys.x\\$schema_index_statistics ORDER BY insert_latency DESC LIMIT 15;'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     # TOP 15 high update latency index
@@ -4241,14 +4407,14 @@ sub mysqsl_pfs {
     $nbL = 1;
     for my $lQuery (
         select_array(
-'use sys;select table_schema, table_name,index_name, update_latency from schema_index_statistics ORDER BY update_latency DESC LIMIT 15;'
+'use sys;select table_schema, table_name,index_name, update_latency from sys.x\\$schema_index_statistics ORDER BY update_latency DESC LIMIT 15;'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     # TOP 15 high delete latency index
@@ -4256,14 +4422,14 @@ sub mysqsl_pfs {
     $nbL = 1;
     for my $lQuery (
         select_array(
-'use sys;select table_schema, table_name,index_name, delete_latency from schema_index_statistics ORDER BY delete_latency DESC LIMIT 15;'
+'use sys;select table_schema, table_name,index_name, delete_latency from sys.x\\$schema_index_statistics ORDER BY delete_latency DESC LIMIT 15;'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     # TOP 15 most read tables
@@ -4271,14 +4437,14 @@ sub mysqsl_pfs {
     $nbL = 1;
     for my $lQuery (
         select_array(
-'use sys;select table_schema, table_name, rows_fetched from schema_table_statistics ORDER BY ROWs_fetched DESC LIMIT 15;'
+'use sys;select table_schema, table_name, rows_fetched from sys.x\\$schema_table_statistics ORDER BY ROWs_fetched DESC LIMIT 15;'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     # TOP 15 most used tables
@@ -4286,14 +4452,14 @@ sub mysqsl_pfs {
     $nbL = 1;
     for my $lQuery (
         select_array(
-'use sys;select table_schema, table_name, rows_inserted+rows_updated+rows_deleted AS changes from schema_table_statistics ORDER BY rows_inserted+rows_updated+rows_deleted DESC LIMIT 15;'
+'use sys;select table_schema, table_name, rows_inserted+rows_updated+rows_deleted AS changes from sys.x\\$schema_table_statistics ORDER BY rows_inserted+rows_updated+rows_deleted DESC LIMIT 15;'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     # TOP 15 high read latency tables
@@ -4301,14 +4467,14 @@ sub mysqsl_pfs {
     $nbL = 1;
     for my $lQuery (
         select_array(
-'use sys;select table_schema, table_name, fetch_latency from schema_table_statistics ORDER BY fetch_latency DESC LIMIT 15;'
+'use sys;select table_schema, table_name, fetch_latency from sys.x\\$schema_table_statistics ORDER BY fetch_latency DESC LIMIT 15;'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     # TOP 15 high insert latency tables
@@ -4316,14 +4482,14 @@ sub mysqsl_pfs {
     $nbL = 1;
     for my $lQuery (
         select_array(
-'use sys;select table_schema, table_name, insert_latency from schema_table_statistics ORDER BY insert_latency DESC LIMIT 15;'
+'use sys;select table_schema, table_name, insert_latency from sys.x\\$schema_table_statistics ORDER BY insert_latency DESC LIMIT 15;'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     # TOP 15 high update latency tables
@@ -4331,14 +4497,14 @@ sub mysqsl_pfs {
     $nbL = 1;
     for my $lQuery (
         select_array(
-'use sys;select table_schema, table_name, update_latency from schema_table_statistics ORDER BY update_latency DESC LIMIT 15;'
+'use sys;select table_schema, table_name, update_latency from sys.x\\$schema_table_statistics ORDER BY update_latency DESC LIMIT 15;'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     # TOP 15 high delete latency tables
@@ -4346,14 +4512,14 @@ sub mysqsl_pfs {
     $nbL = 1;
     for my $lQuery (
         select_array(
-'use sys;select table_schema, table_name, delete_latency from schema_table_statistics ORDER BY delete_latency DESC LIMIT 15;'
+'use sys;select table_schema, table_name, delete_latency from sys.x\\$schema_table_statistics ORDER BY delete_latency DESC LIMIT 15;'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     # Redundant indexes
@@ -4365,90 +4531,63 @@ sub mysqsl_pfs {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
-      if ( $nbL == 1 );
-
-    subheaderprint "Performance schema: Tables not using InnoDB buffer";
-    $nbL = 1;
-    for my $lQuery (
-        select_array(
-' Select table_schema, table_name from sys.schema_table_statistics_with_buffer where innodb_buffer_allocated IS NULL;'
-        )
-      )
-    {
-        infoprint " +-- $nbL: $lQuery";
-        $nbL++;
-    }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     subheaderprint "Performance schema: Table not using InnoDB buffer";
     $nbL = 1;
     for my $lQuery (
         select_array(
-' Select table_schema, table_name from sys.schema_table_statistics_with_buffer where innodb_buffer_allocated IS NULL;'
-        )
-      )
-    {
-        infoprint " +-- $nbL: $lQuery";
-        $nbL++;
-    }
-    infoprint "No information found or indicators desactivated."
-      if ( $nbL == 1 );
-    subheaderprint "Performance schema: Table not using InnoDB buffer";
-    $nbL = 1;
-    for my $lQuery (
-        select_array(
-' Select table_schema, table_name from sys.schema_table_statistics_with_buffer where innodb_buffer_allocated IS NULL;'
+' Select table_schema, table_name from sys.x\\$schema_table_statistics_with_buffer where innodb_buffer_allocated IS NULL;'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     subheaderprint "Performance schema: Top 15 Tables using InnoDB buffer";
     $nbL = 1;
     for my $lQuery (
         select_array(
-'select table_schema,table_name,innodb_buffer_allocated from sys.schema_table_statistics_with_buffer where innodb_buffer_allocated IS NOT NULL ORDER BY innodb_buffer_allocated DESC LIMIT 15;'
+'select table_schema,table_name,innodb_buffer_allocated from sys.x\\$schema_table_statistics_with_buffer where innodb_buffer_allocated IS NOT NULL ORDER BY innodb_buffer_allocated DESC LIMIT 15;'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     subheaderprint "Performance schema: Top 15 Tables with InnoDB buffer free";
     $nbL = 1;
     for my $lQuery (
         select_array(
-'select table_schema,table_name,innodb_buffer_free from sys.schema_table_statistics_with_buffer where innodb_buffer_allocated IS NOT NULL ORDER BY innodb_buffer_free DESC LIMIT 15;'
+'select table_schema,table_name,innodb_buffer_free from sys.x\\$schema_table_statistics_with_buffer where innodb_buffer_allocated IS NOT NULL ORDER BY innodb_buffer_free DESC LIMIT 15;'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     subheaderprint "Performance schema: Top 15 Most executed queries";
     $nbL = 1;
     for my $lQuery (
         select_array(
-'select db, query, exec_count from sys.statement_analysis order by exec_count DESC LIMIT 15;'
+'select db, LEFT(query, 120), exec_count from sys.x\\$statement_analysis order by exec_count DESC LIMIT 15;'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     subheaderprint
@@ -4456,56 +4595,56 @@ sub mysqsl_pfs {
     $nbL = 1;
     for my $lQuery (
         select_array(
-'select query, last_seen from sys.statements_with_errors_or_warnings ORDER BY last_seen LIMIT 100;'
+'select LEFT(query, 120), last_seen from sys.x\\$statements_with_errors_or_warnings ORDER BY last_seen LIMIT 40;'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     subheaderprint "Performance schema: Top 20 queries with full table scans";
     $nbL = 1;
     for my $lQuery (
         select_array(
-'select db, query, exec_count from sys.statements_with_full_table_scans order BY exec_count DESC LIMIT 20;'
+'select db, LEFT(query, 120), exec_count from sys.x\\$statements_with_full_table_scans order BY exec_count DESC LIMIT 20;'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     subheaderprint "Performance schema: Last 50 queries with full table scans";
     $nbL = 1;
     for my $lQuery (
         select_array(
-'select db, query, last_seen from sys.statements_with_full_table_scans order BY last_seen DESC LIMIT 50;'
+'select db, LEFT(query, 120), last_seen from sys.x\\$statements_with_full_table_scans order BY last_seen DESC LIMIT 50;'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     subheaderprint "Performance schema: TOP 15 reader queries (95% percentile)";
     $nbL = 1;
     for my $lQuery (
         select_array(
-'use sys;select db, query , rows_sent from statements_with_runtimes_in_95th_percentile ORDER BY ROWs_sent DESC LIMIT 15;'
+'use sys;select db, LEFT(query, 120), rows_sent from sys.x\\$statements_with_runtimes_in_95th_percentile ORDER BY ROWs_sent DESC LIMIT 15;'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     subheaderprint
@@ -4513,14 +4652,14 @@ sub mysqsl_pfs {
     $nbL = 1;
     for my $lQuery (
         select_array(
-'use sys;select db, query, rows_examined AS search from statements_with_runtimes_in_95th_percentile ORDER BY rows_examined DESC LIMIT 15;'
+'use sys;select db, LEFT(query, 120), rows_examined AS search from sys.x\\$statements_with_runtimes_in_95th_percentile ORDER BY rows_examined DESC LIMIT 15;'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     subheaderprint
@@ -4528,14 +4667,14 @@ sub mysqsl_pfs {
     $nbL = 1;
     for my $lQuery (
         select_array(
-'use sys;select db, query, total_latency AS search from statements_with_runtimes_in_95th_percentile ORDER BY total_latency DESC LIMIT 15;'
+'use sys;select db, LEFT(query, 120), total_latency AS search from sys.x\\$statements_with_runtimes_in_95th_percentile ORDER BY total_latency DESC LIMIT 15;'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     subheaderprint
@@ -4543,14 +4682,14 @@ sub mysqsl_pfs {
     $nbL = 1;
     for my $lQuery (
         select_array(
-'use sys;select db, query, max_latency AS search from statements_with_runtimes_in_95th_percentile ORDER BY max_latency DESC LIMIT 15;'
+'use sys;select db, LEFT(query, 120), max_latency AS search from sys.x\\$statements_with_runtimes_in_95th_percentile ORDER BY max_latency DESC LIMIT 15;'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     subheaderprint
@@ -4558,84 +4697,84 @@ sub mysqsl_pfs {
     $nbL = 1;
     for my $lQuery (
         select_array(
-'use sys;select db, query, avg_latency AS search from statements_with_runtimes_in_95th_percentile ORDER BY avg_latency DESC LIMIT 15;'
+'use sys;select db, LEFT(query, 120), avg_latency AS search from sys.x\\$statements_with_runtimes_in_95th_percentile ORDER BY avg_latency DESC LIMIT 15;'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     subheaderprint "Performance schema: Top 20 queries with sort";
     $nbL = 1;
     for my $lQuery (
         select_array(
-'select db, query, exec_count from sys.statements_with_sorting order BY exec_count DESC LIMIT 20;'
+'select db, LEFT(query, 120), exec_count from sys.x\\$statements_with_sorting order BY exec_count DESC LIMIT 20;'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     subheaderprint "Performance schema: Last 50 queries with sort";
     $nbL = 1;
     for my $lQuery (
         select_array(
-'select db, query, last_seen from sys.statements_with_sorting order BY last_seen DESC LIMIT 50;'
+'select db, LEFT(query, 120), last_seen from sys.x\\$statements_with_sorting order BY last_seen DESC LIMIT 50;'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     subheaderprint "Performance schema: TOP 15 row sorting queries with sort";
     $nbL = 1;
     for my $lQuery (
         select_array(
-'use sys;select db, query , rows_sorted from statements_with_sorting ORDER BY ROWs_sorted DESC LIMIT 15;'
+'use sys;select db, LEFT(query, 120), rows_sorted from sys.x\\$statements_with_sorting ORDER BY ROWs_sorted DESC LIMIT 15;'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     subheaderprint "Performance schema: TOP 15 total latency queries with sort";
     $nbL = 1;
     for my $lQuery (
         select_array(
-'use sys;select db, query, total_latency AS search from statements_with_sorting ORDER BY total_latency DESC LIMIT 15;'
+'use sys;select db, LEFT(query, 120), total_latency AS search from sys.x\\$statements_with_sorting ORDER BY total_latency DESC LIMIT 15;'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     subheaderprint "Performance schema: TOP 15 merge queries with sort";
     $nbL = 1;
     for my $lQuery (
         select_array(
-'use sys;select db, query, sort_merge_passes AS search from statements_with_sorting ORDER BY sort_merge_passes DESC LIMIT 15;'
+'use sys;select db, LEFT(query, 120), sort_merge_passes AS search from sys.x\\$statements_with_sorting ORDER BY sort_merge_passes DESC LIMIT 15;'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     subheaderprint
@@ -4643,42 +4782,42 @@ sub mysqsl_pfs {
     $nbL = 1;
     for my $lQuery (
         select_array(
-'use sys;select db, query, avg_sort_merges AS search from statements_with_sorting ORDER BY avg_sort_merges DESC LIMIT 15;'
+'select db, LEFT(query, 120), avg_sort_merges AS search from sys.x\\$statements_with_sorting ORDER BY avg_sort_merges DESC LIMIT 15;'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     subheaderprint "Performance schema: TOP 15 scans queries with sort";
     $nbL = 1;
     for my $lQuery (
         select_array(
-'use sys;select db, query, sorts_using_scans AS search from statements_with_sorting ORDER BY sorts_using_scans DESC LIMIT 15;'
+'use sys;select db, LEFT(query, 120), sorts_using_scans AS search from sys.x\\$statements_with_sorting ORDER BY sorts_using_scans DESC LIMIT 15;'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     subheaderprint "Performance schema: TOP 15 range queries with sort";
     $nbL = 1;
     for my $lQuery (
         select_array(
-'use sys;select db, query, sort_using_range AS search from statements_with_sorting ORDER BY sort_using_range DESC LIMIT 15;'
+'use sys;select db, LEFT(query, 120), sort_using_range AS search from sys.x\\$statements_with_sorting ORDER BY sort_using_range DESC LIMIT 15;'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
 ##################################################################################
@@ -4707,28 +4846,28 @@ sub mysqsl_pfs {
     $nbL = 1;
     for my $lQuery (
         select_array(
-'select db, query, exec_count from sys.statements_with_temp_tables order BY exec_count DESC LIMIT 20;'
+'select db, LEFT(query, 120), exec_count from sys.x\\$statements_with_temp_tables order BY exec_count DESC LIMIT 20;'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     subheaderprint "Performance schema: Last 50 queries with temp table";
     $nbL = 1;
     for my $lQuery (
         select_array(
-'select db, query, last_seen from sys.statements_with_temp_tables order BY last_seen DESC LIMIT 50;'
+'select db, LEFT(query, 120), last_seen from sys.x\\$statements_with_temp_tables order BY last_seen DESC LIMIT 50;'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     subheaderprint
@@ -4736,28 +4875,28 @@ sub mysqsl_pfs {
     $nbL = 1;
     for my $lQuery (
         select_array(
-'use sys;select db, query, total_latency AS search from statements_with_temp_tables ORDER BY total_latency DESC LIMIT 15;'
+'select db, LEFT(query, 120), total_latency AS search from sys.x\\$statements_with_temp_tables ORDER BY total_latency DESC LIMIT 15;'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     subheaderprint "Performance schema: TOP 15 queries with temp table to disk";
     $nbL = 1;
     for my $lQuery (
         select_array(
-'use sys;select db, query, disk_tmp_tables from statements_with_temp_tables ORDER BY disk_tmp_tables DESC LIMIT 15;'
+'use sys;select db, LEFT(query, 120), disk_tmp_tables from sys.x\\$statements_with_temp_tables ORDER BY disk_tmp_tables DESC LIMIT 15;'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
 ##################################################################################
@@ -4777,84 +4916,84 @@ sub mysqsl_pfs {
     $nbL = 1;
     for my $lQuery (
         select_array(
-'use sys;select event_class, total from wait_classes_global_by_latency ORDER BY total DESC LIMIT 15;'
+'use sys;select event_class, total from sys.x\\$wait_classes_global_by_latency ORDER BY total DESC LIMIT 15;'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     subheaderprint "Performance schema: TOP 30 events by number";
     $nbL = 1;
     for my $lQuery (
         select_array(
-'use sys;select events, total from waits_global_by_latency ORDER BY total DESC LIMIT 30;'
+'use sys;select events, total from sys.x\\$waits_global_by_latency ORDER BY total DESC LIMIT 30;'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     subheaderprint "Performance schema: TOP 15 class events by total latency";
     $nbL = 1;
     for my $lQuery (
         select_array(
-'use sys;select event_class, total_latency from wait_classes_global_by_latency ORDER BY total_latency DESC LIMIT 15;'
+'use sys;select event_class, total_latency from sys.x\\$wait_classes_global_by_latency ORDER BY total_latency DESC LIMIT 15;'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     subheaderprint "Performance schema: TOP 30 events by total latency";
     $nbL = 1;
     for my $lQuery (
         select_array(
-'use sys;select events, total_latency from waits_global_by_latency ORDER BY total_latency DESC LIMIT 30;'
+'use sys;select events, total_latency from sys.x\\$waits_global_by_latency ORDER BY total_latency DESC LIMIT 30;'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     subheaderprint "Performance schema: TOP 15 class events by max latency";
     $nbL = 1;
     for my $lQuery (
         select_array(
-'use sys;select event_class, max_latency from wait_classes_global_by_latency ORDER BY max_latency DESC LIMIT 15;'
+'select event_class, max_latency from sys.x\\$wait_classes_global_by_latency ORDER BY max_latency DESC LIMIT 15;'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
     subheaderprint "Performance schema: TOP 30 events by max latency";
     $nbL = 1;
     for my $lQuery (
         select_array(
-'use sys;select events, max_latency from waits_global_by_latency ORDER BY max_latency DESC LIMIT 30;'
+'select events, max_latency from sys.x\\$waits_global_by_latency ORDER BY max_latency DESC LIMIT 30;'
         )
       )
     {
         infoprint " +-- $nbL: $lQuery";
         $nbL++;
     }
-    infoprint "No information found or indicators desactivated."
+    infoprint "No information found or indicators deactivated."
       if ( $nbL == 1 );
 
 }
@@ -4974,7 +5113,7 @@ sub mariadb_rockdb {
     }
     infoprint "RocksDB is enabled.";
 
-    # All is to done here
+    # All is to do here
 }
 
 # Recommendations for Spider
@@ -4990,7 +5129,7 @@ sub mariadb_spider {
     }
     infoprint "Spider is enabled.";
 
-    # All is to done here
+    # All is to do here
 }
 
 # Recommendations for Connect
@@ -5004,14 +5143,15 @@ sub mariadb_connect {
         infoprint "Connect is disabled.";
         return;
     }
-    infoprint "TokuDB is enabled.";
+    infoprint "Connect is enabled.";
 
-    # All is to done here
+    # All is to do here
 }
 
 # Perl trim function to remove whitespace from the start and end of the string
 sub trim {
     my $string = shift;
+    return "" unless defined($string);
     $string =~ s/^\s+//;
     $string =~ s/\s+$//;
     return $string;
@@ -5020,7 +5160,7 @@ sub trim {
 sub get_wsrep_options {
     return () unless defined $myvar{'wsrep_provider_options'};
 
-    my @galera_options = split /;/, $myvar{'wsrep_provider_options'};
+    my @galera_options      = split /;/, $myvar{'wsrep_provider_options'};
     my $wsrep_slave_threads = $myvar{'wsrep_slave_threads'};
     push @galera_options, ' wsrep_slave_threads = ' . $wsrep_slave_threads;
     @galera_options = remove_cr @galera_options;
@@ -5042,7 +5182,7 @@ sub get_wsrep_option {
     my @galera_options = get_wsrep_options;
     return '' unless scalar(@galera_options) > 0;
     my @memValues = grep /\s*$key =/, @galera_options;
-    my $memValue = $memValues[0];
+    my $memValue  = $memValues[0];
     return 0 unless defined $memValue;
     $memValue =~ s/.*=\s*(.+)$/$1/g;
     return $memValue;
@@ -5067,7 +5207,10 @@ sub mariadb_galera {
         debugprint "\t" . trim($gvar) . " = " . $myvar{$gvar};
         $result{'Galera'}{'variables'}{$gvar} = $myvar{$gvar};
     }
-
+    if ( not defined( $myvar{'wsrep_on'} ) or $myvar{'wsrep_on'} ne "ON" ) {
+        infoprint "Galera is disabled.";
+        return;
+    }
     debugprint "Galera wsrep provider Options:";
     my @galera_options = get_wsrep_options;
     $result{'Galera'}{'wsrep options'} = get_wsrep_options();
@@ -5082,6 +5225,8 @@ sub mariadb_galera {
     }
     infoprint "GCache is using "
       . hr_bytes_rnd( get_wsrep_option('gcache.mem_size') );
+
+    #my @primaryKeysNbTables=();
     my @primaryKeysNbTables = select_array(
         "Select CONCAT(c.table_schema,CONCAT('.', c.table_name))
 from information_schema.columns c
@@ -5092,12 +5237,14 @@ group by c.table_schema,c.table_name
 having sum(if(c.column_key in ('PRI','UNI'), 1,0)) = 0"
     );
 
-    if (   get_wsrep_option('wsrep_slave_threads') > (cpu_cores) * 4
-        or get_wsrep_option('wsrep_slave_threads') < (cpu_cores) * 3 )
+    infoprint "CPU core detected  : " . (cpu_cores);
+    infoprint "wsrep_slave_threads: " . get_wsrep_option('wsrep_slave_threads');
+    if (   get_wsrep_option('wsrep_slave_threads') > ( (cpu_cores) * 4 )
+        or get_wsrep_option('wsrep_slave_threads') < ( (cpu_cores) * 2 ) )
     {
         badprint
 "wsrep_slave_threads is not equal to 2, 3 or 4 times number of CPU(s)";
-        push @adjvars, "wsrep_slave_threads= Nb of Core CPU * 4";
+        push @adjvars, "wsrep_slave_threads = " . ( (cpu_cores) * 4 );
     }
     else {
         goodprint
@@ -5211,7 +5358,7 @@ having sum(if(c.column_key in ('PRI','UNI'), 1,0)) = 0"
             goodprint "Galera Cluster address is defined: "
               . $myvar{'wsrep_cluster_address'};
             my @NodesTmp = split /,/, $myvar{'wsrep_cluster_address'};
-            my $nbNodes = @NodesTmp;
+            my $nbNodes  = @NodesTmp;
             infoprint "There are $nbNodes nodes in wsrep_cluster_address";
             my $nbNodesSize = trim( $mystat{'wsrep_cluster_size'} );
             if ( $nbNodesSize == 3 or $nbNodesSize == 5 ) {
@@ -5266,7 +5413,9 @@ having sum(if(c.column_key in ('PRI','UNI'), 1,0)) = 0"
             badprint "Galera Notify command is not defined.";
             push( @adjvars, "set up parameter wsrep_notify_cmd to be notify" );
         }
-        if ( trim( $myvar{'wsrep_sst_method'} ) !~ "^xtrabackup.*" ) {
+        if (    trim( $myvar{'wsrep_sst_method'} ) !~ "^xtrabackup.*"
+            and trim( $myvar{'wsrep_sst_method'} ) !~ "^mariabackup" )
+        {
             badprint "Galera SST method is not xtrabackup based.";
             push( @adjvars,
 "set up parameter wsrep_sst_method to xtrabackup based parameter"
@@ -5365,6 +5514,10 @@ sub mysql_innodb {
         && $myvar{'have_innodb'} eq "YES"
         && defined $enginestats{'InnoDB'} )
     {
+       if ( $opt{skipsize} eq 1 ) {
+            infoprint "Skipped due to --skipsize option";
+            return;
+        }
         infoprint "InnoDB is disabled.";
         if ( mysql_version_ge( 5, 5 ) ) {
             badprint
@@ -5448,7 +5601,7 @@ sub mysql_innodb {
           . hr_bytes( $enginestats{'InnoDB'} ) . "";
         push( @adjvars,
                 "innodb_buffer_pool_size (>= "
-              . hr_bytes_rnd( $enginestats{'InnoDB'} )
+              . hr_bytes( $enginestats{'InnoDB'} )
               . ") if possible." );
     }
     if (   $mycalc{'innodb_log_size_pct'} < 20
@@ -5459,7 +5612,7 @@ sub mysql_innodb {
           . hr_bytes( $myvar{'innodb_log_file_size'} ) . " * "
           . $myvar{'innodb_log_files_in_group'} . "/"
           . hr_bytes( $myvar{'innodb_buffer_pool_size'} )
-          . " should be equal 25%";
+          . " should be equal to 25%";
         push(
             @adjvars,
             "innodb_log_file_size should be (="
@@ -5470,7 +5623,7 @@ sub mysql_innodb {
               . ") if possible, so InnoDB total log files size equals to 25% of buffer pool size."
         );
         push( @generalrec,
-"Read this before changing innodb_log_file_size and/or innodb_log_files_in_group: http://bit.ly/2wgkDvS"
+"Before changing innodb_log_file_size and/or innodb_log_files_in_group read this: https://bit.ly/2TcGgtU"
         );
     }
     else {
@@ -5478,7 +5631,7 @@ sub mysql_innodb {
           . hr_bytes( $myvar{'innodb_log_file_size'} ) . " * "
           . $myvar{'innodb_log_files_in_group'} . "/"
           . hr_bytes( $myvar{'innodb_buffer_pool_size'} )
-          . " should be equal 25%";
+          . " should be equal to 25%";
     }
 
     # InnoDB Buffer Pool Instances (MySQL 5.6.6+)
@@ -5565,7 +5718,7 @@ sub mysql_innodb {
         }
     }
 
-    # InnoDB Read efficency
+    # InnoDB Read efficiency
     if ( defined $mycalc{'pct_read_efficiency'}
         && $mycalc{'pct_read_efficiency'} < 90 )
     {
@@ -5639,6 +5792,24 @@ sub mysql_innodb {
     $result{'Calculations'} = {%mycalc};
 }
 
+sub check_metadata_perf {
+    subheaderprint "Analysis Performance Metrics";
+    if ( defined $myvar{'innodb_stats_on_metadata'} ) {
+        infoprint "innodb_stats_on_metadata: "
+          . $myvar{'innodb_stats_on_metadata'};
+        if ( $myvar{'innodb_stats_on_metadata'} eq 'ON' ) {
+            badprint "Stat are updated during querying INFORMATION_SCHEMA.";
+            push @adjvars, "SET innodb_stats_on_metadata = OFF";
+
+            #Disabling innodb_stats_on_metadata
+            select_one("SET GLOBAL innodb_stats_on_metadata = OFF;");
+            return 1;
+        }
+    }
+    goodprint "No stat updates during querying INFORMATION_SCHEMA.";
+    return 0;
+}
+
 # Recommendations for Database metrics
 sub mysql_databases {
     return if ( $opt{dbstat} == 0 );
@@ -5817,7 +5988,7 @@ sub mysql_databases {
 
 # Recommendations for database columns
 sub mysql_tables {
-    return if ( $opt{dbstat} == 0 );
+    return if ( $opt{tbstat} == 0 );
 
     subheaderprint "Table Column Metrics";
     unless ( mysql_version_ge( 5, 5 ) ) {
@@ -5825,6 +5996,9 @@ sub mysql_tables {
 "Skip Database metrics from information schema missing in this version";
         return;
     }
+    if (mysql_version_ge(8) and not mysql_version_eq(10)) {
+        infoprint "MySQL and Percona version 8 and greater have remove PROCEDURE ANALYSE feature"
+    }
     my @dblist = select_array(
 "SELECT DISTINCT TABLE_SCHEMA FROM information_schema.TABLES WHERE TABLE_SCHEMA NOT IN ( 'mysql', 'performance_schema', 'information_schema', 'sys' );"
     );
@@ -5848,21 +6022,31 @@ sub mysql_tables {
                 my $isnull = select_one(
 "SELECT IS_NULLABLE FROM information_schema.COLUMNS WHERE TABLE_SCHEMA='$dbname' AND TABLE_NAME='$tbname' AND COLUMN_NAME='$_' "
                 );
+
                 infoprint "     +-- Column $tbname.$_:";
                 my $current_type =
                   uc($ctype) . ( $isnull eq 'NO' ? " NOT NULL" : "" );
-                my $optimal_type = select_str_g( "Optimal_fieldtype",
-                    "SELECT $_ FROM $dbname.$tbname PROCEDURE ANALYSE(100000)"
-                );
-
-                if ( $current_type ne $optimal_type ) {
+                my $optimal_type='';
+                $optimal_type = select_str_g( "Optimal_fieldtype",
+"SELECT \\`$_\\` FROM \\`$dbname\\`.\\`$tbname\\` PROCEDURE ANALYSE(100000)"
+                ) unless (mysql_version_ge(8) and not mysql_version_eq(10));
+                if ( $optimal_type eq '' ) {
                     infoprint "      Current Fieldtype: $current_type";
-                    infoprint "      Optimal Fieldtype: $optimal_type";
-                    badprint
+                    #infoprint "      Optimal Fieldtype: Not available";
+                }
+                elsif ( $current_type ne $optimal_type and $current_type !~ /.*DATETIME.*/ and $current_type !~ /.*TIMESTAMP.*/) {
+                    infoprint "      Current Fieldtype: $current_type";
+                    if ($optimal_type =~ /.*ENUM\(.*/ ) {
+                        $optimal_type ="ENUM( ... )";
+                    }
+                    infoprint "      Optimal Fieldtype: $optimal_type ";
+                    if ($optimal_type !~ /.*ENUM\(.*/ ) {
+                        badprint
 "Consider changing type for column $_ in table $dbname.$tbname";
                     push( @generalrec,
-                        "ALTER TABLE $dbname.$tbname MODIFY $_ $optimal_type;"
+"ALTER TABLE \`$dbname\`.\`$tbname\` MODIFY \`$_\` $optimal_type;"
                     );
+                }
 
                 }
                 else {
@@ -5962,7 +6146,7 @@ FROM performance_schema.table_io_waits_summary_by_index_usage
 WHERE index_name IS NOT NULL
 AND count_star =0
 AND index_name <> 'PRIMARY'
-AND object_schema != 'mysql'
+AND object_schema NOT IN ( 'mysql', 'performance_schema', 'information_schema' )
 ORDER BY count_star, object_schema, object_name;
 ENDSQL
     @idxinfo = select_array($selIdxReq);
@@ -6042,7 +6226,6 @@ if ( $opt{'template'} ne 0 ) {
     $templateModel = file2string( $opt{'template'} );
 }
 else {
-
     # DEFAULT REPORT TEMPLATE
     $templateModel = <<'END_TEMPLATE';
 <!DOCTYPE html>
@@ -6064,45 +6247,61 @@ END_TEMPLATE
 }
 
 sub dump_result {
-    if ( $opt{'debug'} ) {
-        debugprint Dumper( \%result );
-    }
-
+    debugprint Dumper( \%result ) if ( $opt{'debug'} );
     debugprint "HTML REPORT: $opt{'reportfile'}";
 
     if ( $opt{'reportfile'} ne 0 ) {
         eval { require Text::Template };
+        eval { require JSON };
         if ($@) {
             badprint "Text::Template Module is needed.";
-            exit 1;
+            die "Text::Template Module is needed.";
         }
 
-        my $vars = { 'data' => Dumper( \%result ) };
-
+        my $json      = JSON->new->allow_nonref;
+        my $json_text = $json->pretty->encode( \%result );
+        my %vars      = (
+            'data'  => \%result,
+            'debug' => $json_text,
+        );
         my $template;
         {
             no warnings 'once';
             $template = Text::Template->new(
-                TYPE    => 'STRING',
-                PREPEND => q{;},
-                SOURCE  => $templateModel
+                TYPE       => 'STRING',
+                PREPEND    => q{;},
+                SOURCE     => $templateModel,
+                DELIMITERS => [ '[%', '%]' ]
             ) or die "Couldn't construct template: $Text::Template::ERROR";
         }
+
         open my $fh, q(>), $opt{'reportfile'}
           or die
 "Unable to open $opt{'reportfile'} in write mode. please check permissions for this file or directory";
-        $template->fill_in( HASH => $vars, OUTPUT => $fh );
+        $template->fill_in( HASH => \%vars, OUTPUT => $fh );
         close $fh;
     }
+
     if ( $opt{'json'} ne 0 ) {
         eval { require JSON };
         if ($@) {
             print "$bad JSON Module is needed.\n";
-            exit 1;
+            return 1;
         }
+
         my $json = JSON->new->allow_nonref;
         print $json->utf8(1)->pretty( ( $opt{'prettyjson'} ? 1 : 0 ) )
           ->encode( \%result );
+
+        if ( $opt{'outputfile'} ne 0 ) {
+            unlink $opt{'outputfile'} if ( -e $opt{'outputfile'} );
+            open my $fh, q(>), $opt{'outputfile'}
+              or die
+"Unable to open $opt{'outputfile'} in write mode. please check permissions for this file or directory";
+            print $fh $json->utf8(1)->pretty( ( $opt{'prettyjson'} ? 1 : 0 ) )
+              ->encode( \%result );
+            close $fh;
+        }
     }
 }
 
@@ -6112,9 +6311,7 @@ sub which {
     my @path_array  = split /:/, $ENV{'PATH'};
 
     for my $path (@path_array) {
-        if ( -x "$path/$prog_name" ) {
-            return "$path/$prog_name";
-        }
+        return "$path/$prog_name" if ( -x "$path/$prog_name" );
     }
 
     return 0;
@@ -6127,38 +6324,45 @@ headerprint;    # Header Print
 
 validate_tuner_version;    # Check last version
 mysql_setup;               # Gotta login first
-os_setup;                  # Set up some OS variables
-get_all_vars;              # Toss variables/status into hashes
-get_tuning_info;           # Get information about the tuning connexion
-validate_mysql_version;    # Check current MySQL version
-
-check_architecture;        # Suggest 64-bit upgrade
-system_recommendations;    # avoid to many service on the same host
-log_file_recommandations;  # check log file content
-check_storage_engines;     # Show enabled storage engines
-mysql_databases;           # Show informations about databases
-mysql_tables;              # Show informations about table column
-
-mysql_indexes;             # Show informations about indexes
-security_recommendations;  # Display some security recommendations
-cve_recommendations;       # Display related CVE
-calculations;              # Calculate everything we need
-mysql_stats;               # Print the server stats
-mysqsl_pfs;                # Print Performance schema info
-mariadb_threadpool;        # Print MaraiDB ThreadPool stats
-mysql_myisam;              # Print MyISAM stats
-mysql_innodb;              # Print InnoDB stats
-mariadb_ariadb;            # Print MaraiDB AriaDB stats
-mariadb_tokudb;            # Print MariaDB Tokudb stats
-mariadb_xtradb;            # Print MariaDB XtraDB stats
-mariadb_rockdb;            # Print MariaDB RockDB stats
-mariadb_spider;            # Print MariaDB Spider stats
-mariadb_connect;           # Print MariaDB Connect stats
-mariadb_galera;            # Print MariaDB Galera Cluster stats
-get_replication_status;    # Print replication info
-make_recommendations;      # Make recommendations based on stats
-dump_result;               # Dump result if debug is on
-close_outputfile;          # Close reportfile if needed
+debugprint "MySQL FINAL Client : $mysqlcmd $mysqllogin";
+debugprint "MySQL Admin FINAL Client : $mysqladmincmd $mysqllogin";
+
+#exit(0);
+os_setup;                    # Set up some OS variables
+get_all_vars;                # Toss variables/status into hashes
+get_tuning_info;             # Get information about the tuning connexion
+validate_mysql_version;      # Check current MySQL version
+
+check_architecture;          # Suggest 64-bit upgrade
+system_recommendations;      # avoid to many service on the same host
+log_file_recommendations;    # check log file content
+check_storage_engines;       # Show enabled storage engines
+
+check_metadata_perf;         # Show parameter impacting performance during analysis
+mysql_databases;             # Show informations about databases
+mysql_tables;                # Show informations about table column
+
+mysql_indexes;               # Show informations about indexes
+security_recommendations;    # Display some security recommendations
+cve_recommendations;         # Display related CVE
+calculations;                # Calculate everything we need
+mysql_stats;                 # Print the server stats
+mysqsl_pfs;                  # Print Performance schema info
+mariadb_threadpool;          # Print MariaDB ThreadPool stats
+mysql_myisam;                # Print MyISAM stats
+mysql_innodb;                # Print InnoDB stats
+mariadb_ariadb;              # Print MariaDB AriaDB stats
+mariadb_tokudb;              # Print MariaDB Tokudb stats
+mariadb_xtradb;              # Print MariaDB XtraDB stats
+
+#mariadb_rockdb;             # Print MariaDB RockDB stats
+#mariadb_spider;             # Print MariaDB Spider stats
+#mariadb_connect;            # Print MariaDB Connect stats
+mariadb_galera;              # Print MariaDB Galera Cluster stats
+get_replication_status;      # Print replication info
+make_recommendations;        # Make recommendations based on stats
+dump_result;                 # Dump result if debug is on
+close_outputfile;            # Close reportfile if needed
 
 # ---------------------------------------------------------------------------
 # END 'MAIN'
@@ -6173,7 +6377,7 @@ __END__
 
 =head1 NAME
 
- MySQLTuner 1.7.5 - MySQL High Performance Tuning Script
+ MySQLTuner 1.7.17 - MySQL High Performance Tuning Script
 
 =head1 IMPORTANT USAGE GUIDELINES
 
@@ -6182,7 +6386,7 @@ Allow MySQL server to run for at least 24-48 hours before trusting suggestions
 Some routines may require root level privileges (script will provide warnings)
 You must provide the remote server's total memory when connecting to other servers
 
-=head1 CONNECTION AND AUTHENTIFICATION
+=head1 CONNECTION AND AUTHENTICATION
 
  --host <hostname>           Connect to a remote host to perform tests (default: localhost)
  --socket <socket>           Use a different socket for a local connection
@@ -6214,10 +6418,18 @@ You must provide the remote server's total memory when connecting to other serve
  --nobad                     Remove negative/suggestion responses
  --noinfo                    Remove informational responses
  --debug                     Print debug information
+ --noprocess                Consider no other process is running
  --dbstat                    Print database information
+ --nodbstat                  Don't Print database information
+ --tbstat                    Print table information
+ --notbstat                  Don't Print table information
  --idxstat                   Print index information
+ --noidxstat                 Don't Print index information
  --sysstat                   Print system information
+ --nosysstat                 Don't Print system information
  --pfstat                    Print Performance schema
+ --nopfstat                  Don't Print Performance schema
+ --verbose                   Prints out all options (default: no verbose, dbstat, idxstat, sysstat, tbstat, pfstat)
  --bannedports               Ports banned separated by comma(,)
  --maxportallowed            Number of ports opened allowed on this hosts
  --cvefile <path>            CVE File for vulnerability checks
@@ -6227,7 +6439,7 @@ You must provide the remote server's total memory when connecting to other serve
  --outputfile <path>         Path to a output txt file
  --reportfile <path>         Path to a report txt file
  --template   <path>         Path to a template file
- --verbose                   Prints out all options (default: no verbose)
+
 
 =head1 PERLDOC
 
@@ -6404,11 +6616,11 @@ L<https://github.com/major/MySQLTuner-perl>
 
 =head1 COPYRIGHT AND LICENSE
 
-Copyright (C) 2006-2017 Major Hayden - major@mhtx.net
+Copyright (C) 2006-2018 Major Hayden - major@mhtx.net
 
 For the latest updates, please visit http://mysqltuner.com/
 
-Git repository available at http://github.com/major/MySQLTuner-perl
+Git repository available at https://github.com/major/MySQLTuner-perl
 
 This program is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
@@ -6422,7 +6634,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  See the GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
-along with this program.  If not, see <http://www.gnu.org/licenses/>.
+along with this program.  If not, see <https://www.gnu.org/licenses/>.
 
 =cut