When an expression is evaluated variables get replaced by values. For example, part of the expression for the “MyISAM Key Cache Has Sub-Optimal Hit Rate” rule calculates the hit rate as follows:
100-((%Key_reads% / %Key_read_requests%)*100)
If the current value of %Key_reads%
is 4522
and the current value of %Key_read_requests%
is 125989, the hit ratio assesses to 96.4%:
100 -((4522 / 125989) * 100)
By convention, the Advisors supplied by MySQL use
‘%
’ as the delimiter, for
example, %Key_reads%
. This makes variables
more readily identifiable.
In addition to being used in an expression, variables may also
be used in the Description
,
Advice
, Action
, and
Links
attributes of a rule. This allows you
to report the current value of an expression.
For instance, you can add the message, “The current value
of Key_reads is %Key_reads%.” to the
Advice
text box. When this is displayed on
the screen, the value of %Key_reads%
is
substituted into the text. Supposing
%Key_reads%
has a value of
4522
, the message becomes “The current
value of Key_reads is 4522.”