From e425897b41c98edee9f3555e083240a846475a0e Mon Sep 17 00:00:00 2001 From: Major Hayden Date: Thu, 28 May 2009 01:54:39 +0000 Subject: [PATCH] Fixed an issue where the percentage of keys pulled from memory would not exist if no keys have been read since the server started. (Thanks to Simon Greenaway) --- mysqltuner.pl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mysqltuner.pl b/mysqltuner.pl index 9754c28..3beb01d 100644 --- a/mysqltuner.pl +++ b/mysqltuner.pl @@ -32,6 +32,7 @@ # Blair Christensen Hans du Plooy # Victor Trac Everett Barnes # Tom Krouper Gary Barrueto +# Simon Greenaway # # Inspired by Matthew Montgomery's tuning-primer.sh script: # http://forge.mysql.com/projects/view.php?id=44 @@ -542,6 +543,8 @@ sub calculations { } if ($mystat{'Key_read_requests'} > 0) { $mycalc{'pct_keys_from_mem'} = sprintf("%.1f",(100 - (($mystat{'Key_reads'} / $mystat{'Key_read_requests'}) * 100))); + } else { + $mycalc{'pct_keys_from_mem'} = 0; } if ($doremote eq 0 and $mysqlvermajor < 5) { $mycalc{'total_myisam_indexes'} = `find $myvar{'datadir'} -name '*.MYI' 2>&1 | xargs du -L $duflags '{}' 2>&1 | awk '{ s += \$1 } END { printf (\"%d\",s) }'`;