1 # phpMyAdmin Advisory rules file
3 # Use only UNIX style newlines
5 # This file is being parsed by Advisor.php, which should handle syntax
6 # errors correctly. However, PHP Warnings and the like are being consumed by
7 # the phpMyAdmin error handler, so those won't show up E.g.: Justification line
8 # is empty because you used an unescape percent sign, sprintf() returns an
9 # empty string and no warning/error is shown
12 # 'rule' identifier[the name of the rule] eexpr [an optional precondition]
13 # expr [variable or value calculation used for the test]
14 # expr [test, if evaluted to 'true' it fires the rule. Use 'value' to insert the calculated value (without quotes)]
15 # string [the issue (what is the problem?)]
16 # string [the recommendation (how do i fix it?)]
17 # formatted-string '|' comma-seperated-expr [the justification (result of the calculated value / why did this rule fire?)]
19 # comma-seperated-expr: expr(,expr)*
20 # eexpr: [expr] - expr enclosed in []
21 # expr: a php code literal with extras:
22 # - variable names are replaced with their respective values
23 # - fired('name of rule') is replaced with true/false when given rule has
24 # been fired. Note however that this is a very simple rules engine.
25 # Rules are only checked in sequential order as they are written down
26 # here. If given rule has not been checked yet, fired() will always
28 # - 'value' is replaced with the calculated value. If it is a string, it
29 # will be put within single quotes
30 # - other than that you may use any php function, initialized variable or
33 # identifier: A string enclosed in single quotes
34 # string: A quoteless string, may contain HTML. Variable names enclosed in
35 # curly braces are replaced with links to directly edit this variable.
36 # e.g. {tmp_table_size}
37 # formatted-string: You may use classic php sprintf() string formatting here,
38 # the arguments must be appended after a trailing pipe (|) as
39 # mentioned in above syntax percent signs (%) are
40 # automatically escaped (%%) in the following cases: When
41 # followed by a space, dot or comma and at the end of the
44 # Comments start with #
49 rule 'Uptime below one day'
52 Uptime is less than 1 day, performance tuning may not be accurate.
53 To have more accurate averages it is recommended to let the server run for longer than a day before running this analyzer
54 The uptime is only %s | ADVISOR_timespanFormat(Uptime)
56 rule 'Questions below 1,000'
59 Fewer than 1,000 questions have been run against this server. The recommendations may not be accurate.
60 Let the server run for a longer time until it has executed a greater amount of queries.
61 Current amount of Questions: %s | Questions
63 rule 'Percentage of slow queries' [Questions > 0]
64 Slow_queries / Questions * 100
66 There is a lot of slow queries compared to the overall amount of Queries.
67 You might want to increase {long_query_time} or optimize the queries listed in the slow query log
68 The slow query rate should be below 5%, your value is %s%. | round(value,2)
70 rule 'Slow query rate' [Questions > 0]
71 (Slow_queries / Questions * 100) / Uptime
73 There is a high percentage of slow queries compared to the server uptime.
74 You might want to increase {long_query_time} or optimize the queries listed in the slow query log
75 You have a slow query rate of %s per hour, you should have less than 1% per hour. | ADVISOR_bytime(value,2)
77 rule 'Long query time'
80 {long_query_time} is set to 10 seconds or more, thus only slow queries that take above 10 seconds are logged.
81 It is suggested to set {long_query_time} to a lower value, depending on your environment. Usually a value of 1-5 seconds is suggested.
82 long_query_time is currently set to %ds. | value
84 rule 'Slow query logging' [PMA_MYSQL_INT_VERSION < 50600]
87 The slow query log is disabled.
88 Enable slow query logging by setting {log_slow_queries} to 'ON'. This will help troubleshooting badly performing queries.
89 log_slow_queries is set to 'OFF'
91 rule 'Slow query logging' [PMA_MYSQL_INT_VERSION >= 50600]
94 The slow query log is disabled.
95 Enable slow query logging by setting {slow_query_log} to 'ON'. This will help troubleshooting badly performing queries.
96 slow_query_log is set to 'OFF'
100 rule 'Release Series'
102 substr(value,0,2) <= '5.' && substr(value,2,1) < 1
103 The MySQL server version less than 5.1.
104 You should upgrade, as MySQL 5.1 has improved performance, and MySQL 5.5 even more so.
105 Current version: %s | value
107 rule 'Minor Version' [! fired('Release Series')]
109 substr(value,0,2) <= '5.' && substr(value,2,1) <= 1 && substr(value,4,2) < 30
110 Version less than 5.1.30 (the first GA release of 5.1).
111 You should upgrade, as recent versions of MySQL 5.1 have improved performance and MySQL 5.5 even more so.
112 Current version: %s | value
114 rule 'Minor Version' [! fired('Release Series')]
116 substr(value,0,1) == 5 && substr(value,2,1) == 5 && substr(value,4,2) < 8
117 Version less than 5.5.8 (the first GA release of 5.5).
118 You should upgrade, to a stable version of MySQL 5.5.
119 Current version: %s | value
123 preg_match('/source/i',value)
124 Version is compiled from source, not a MySQL official binary.
125 If you did not compile from source, you may be using a package modified by a distribution. The MySQL manual only is accurate for official MySQL binaries, not any package distributions (such as RedHat, Debian/Ubuntu etc).
126 'source' found in version_comment
130 preg_match('/percona/i',value)
131 The MySQL manual only is accurate for official MySQL binaries.
132 Percona documentation is at <a href="https://www.percona.com/software/documentation/">https://www.percona.com/software/documentation/</a>
133 'percona' found in version_comment
135 rule 'MySQL Architecture'
137 value > 3072*1024 && !preg_match('/64/',version_compile_machine) && !preg_match('/64/',version_compile_os)
138 MySQL is not compiled as a 64-bit package.
139 Your memory capacity is above 3 GiB (assuming the Server is on localhost), so MySQL might not be able to access all of your memory. You might want to consider installing the 64-bit version of MySQL.
140 Available memory on this host: %s | ADVISOR_formatByteDown(value*1024, 2, 2)
145 rule 'Query caching method' [!fired('Query cache disabled')]
148 Suboptimal caching method.
149 You are using the MySQL Query cache with a fairly high traffic database. It might be worth considering to use <a href="https://dev.mysql.com/doc/refman/5.5/en/ha-memcached.html">memcached</a> instead of the MySQL Query cache, especially if you have multiple slaves.
150 The query cache is enabled and the server receives %d queries per second. This rule fires if there is more than 100 queries per second. | round(value,1)
154 rule 'Percentage of sorts that cause temporary tables' [Sort_scan + Sort_range > 0]
155 Sort_merge_passes / (Sort_scan + Sort_range) * 100
157 Too many sorts are causing temporary tables.
158 Consider increasing {sort_buffer_size} and/or {read_rnd_buffer_size}, depending on your system memory limits.
159 %s% of all sorts cause temporary tables, this value should be lower than 10%. | round(value,1)
161 rule 'Rate of sorts that cause temporary tables'
162 Sort_merge_passes / Uptime
164 Too many sorts are causing temporary tables.
165 Consider increasing {sort_buffer_size} and/or {read_rnd_buffer_size}, depending on your system memory limits.
166 Temporary tables average: %s, this value should be less than 1 per hour. | ADVISOR_bytime(value,2)
171 There are lots of rows being sorted.
172 While there is nothing wrong with a high amount of row sorting, you might want to make sure that the queries which require a lot of sorting use indexed columns in the ORDER BY clause, as this will result in much faster sorting.
173 Sorted rows average: %s | ADVISOR_bytime(value,2)
176 rule 'Rate of joins without indexes'
177 (Select_range_check + Select_scan + Select_full_join) / Uptime
179 There are too many joins without indexes.
180 This means that joins are doing full table scans. Adding indexes for the columns being used in the join conditions will greatly speed up table joins.
181 Table joins average: %s, this value should be less than 1 per hour | ADVISOR_bytime(value,2)
183 rule 'Rate of reading first index entry'
184 Handler_read_first / Uptime
186 The rate of reading the first index entry is high.
187 This usually indicates frequent full index scans. Full index scans are faster than table scans but require lots of CPU cycles in big tables, if those tables that have or had high volumes of UPDATEs and DELETEs, running 'OPTIMIZE TABLE' might reduce the amount of and/or speed up full index scans. Other than that full index scans can only be reduced by rewriting queries.
188 Index scans average: %s, this value should be less than 1 per hour | ADVISOR_bytime(value,2)
190 rule 'Rate of reading fixed position'
191 Handler_read_rnd / Uptime
193 The rate of reading data from a fixed position is high.
194 This indicates that many queries need to sort results and/or do a full table scan, including join queries that do not use indexes. Add indexes where applicable.
195 Rate of reading fixed position average: %s, this value should be less than 1 per hour | ADVISOR_bytime(value,2)
197 rule 'Rate of reading next table row'
198 Handler_read_rnd_next / Uptime
200 The rate of reading the next table row is high.
201 This indicates that many queries are doing full table scans. Add indexes where applicable.
202 Rate of reading next table row: %s, this value should be less than 1 per hour | ADVISOR_bytime(value,2)
205 rule 'Different tmp_table_size and max_heap_table_size'
206 tmp_table_size - max_heap_table_size
208 {tmp_table_size} and {max_heap_table_size} are not the same.
209 If you have deliberately changed one of either: The server uses the lower value of either to determine the maximum size of in-memory tables. So if you wish to increase the in-memory table limit you will have to increase the other value as well.
210 Current values are tmp_table_size: %s, max_heap_table_size: %s | ADVISOR_formatByteDown(tmp_table_size, 2, 2), ADVISOR_formatByteDown(max_heap_table_size, 2, 2)
212 rule 'Percentage of temp tables on disk' [Created_tmp_tables + Created_tmp_disk_tables > 0]
213 Created_tmp_disk_tables / (Created_tmp_tables + Created_tmp_disk_tables) * 100
215 Many temporary tables are being written to disk instead of being kept in memory.
216 Increasing {max_heap_table_size} and {tmp_table_size} might help. However some temporary tables are always being written to disk, independent of the value of these variables. To eliminate these you will have to rewrite your queries to avoid those conditions (Within a temporary table: Presence of a BLOB or TEXT column or presence of a column bigger than 512 bytes) as mentioned in the beginning of an <a href="https://www.facebook.com/note.php?note_id=10150111255065841&comments">Article by the Pythian Group</a>
217 %s% of all temporary tables are being written to disk, this value should be below 25% | round(value,1)
219 rule 'Temp disk rate' [!fired('Percentage of temp tables on disk')]
220 Created_tmp_disk_tables / Uptime
222 Many temporary tables are being written to disk instead of being kept in memory.
223 Increasing {max_heap_table_size} and {tmp_table_size} might help. However some temporary tables are always being written to disk, independent of the value of these variables. To eliminate these you will have to rewrite your queries to avoid those conditions (Within a temporary table: Presence of a BLOB or TEXT column or presence of a column bigger than 512 bytes) as mentioned in the <a href="https://dev.mysql.com/doc/refman/5.5/en/internal-temporary-tables.html">MySQL Documentation</a>
224 Rate of temporary tables being written to disk: %s, this value should be less than 1 per hour | ADVISOR_bytime(value,2)
228 rule 'MyISAM key buffer size'
231 Key buffer is not initialized. No MyISAM indexes will be cached.
232 Set {key_buffer_size} depending on the size of your MyISAM indexes. 64M is a good start.
235 rule 'Max % MyISAM key buffer ever used' [key_buffer_size > 0]
236 Key_blocks_used * key_cache_block_size / key_buffer_size * 100
238 MyISAM key buffer (index cache) % used is low.
239 You may need to decrease the size of {key_buffer_size}, re-examine your tables to see if indexes have been removed, or examine queries and expectations about what indexes are being used.
240 max % MyISAM key buffer ever used: %s%, this value should be above 95% | round(value,1)
242 # Don't fire if above rule fired - we don't need the same advice twice
243 rule 'Percentage of MyISAM key buffer used' [key_buffer_size > 0 && !fired('Max % MyISAM key buffer ever used')]
244 ( 1 - Key_blocks_unused * key_cache_block_size / key_buffer_size) * 100
246 MyISAM key buffer (index cache) % used is low.
247 You may need to decrease the size of {key_buffer_size}, re-examine your tables to see if indexes have been removed, or examine queries and expectations about what indexes are being used.
248 % MyISAM key buffer used: %s%, this value should be above 95% | round(value,1)
250 rule 'Percentage of index reads from memory' [Key_read_requests > 0]
251 100 - (Key_reads / Key_read_requests * 100)
253 The % of indexes that use the MyISAM key buffer is low.
254 You may need to increase {key_buffer_size}.
255 Index reads from memory: %s%, this value should be above 95% | round(value,1)
259 rule 'Rate of table open'
260 Opened_tables / Uptime
262 The rate of opening tables is high.
263 Opening tables requires disk I/O which is costly. Increasing {table_open_cache} might avoid this.
264 Opened table rate: %s, this value should be less than 10 per hour | ADVISOR_bytime(value,2)
266 rule 'Percentage of used open files limit'
267 Open_files / open_files_limit * 100
269 The number of open files is approaching the max number of open files. You may get a "Too many open files" error.
270 Consider increasing {open_files_limit}, and check the error log when restarting after changing {open_files_limit}.
271 The number of opened files is at %s% of the limit. It should be below 85% | round(value,1)
273 rule 'Rate of open files'
276 The rate of opening files is high.
277 Consider increasing {open_files_limit}, and check the error log when restarting after changing {open_files_limit}.
278 Opened files rate: %s, this value should be less than 5 per hour | ADVISOR_bytime(value,2)
280 rule 'Immediate table locks %' [Table_locks_waited + Table_locks_immediate > 0]
281 Table_locks_immediate / (Table_locks_waited + Table_locks_immediate) * 100
283 Too many table locks were not granted immediately.
284 Optimize queries and/or use InnoDB to reduce lock wait.
285 Immediate table locks: %s%, this value should be above 95% | round(value,1)
287 rule 'Table lock wait rate'
288 Table_locks_waited / Uptime
290 Too many table locks were not granted immediately.
291 Optimize queries and/or use InnoDB to reduce lock wait.
292 Table lock wait rate: %s, this value should be less than 1 per hour | ADVISOR_bytime(value,2)
297 Thread cache is disabled, resulting in more overhead from new connections to MySQL.
298 Enable the thread cache by setting {thread_cache_size} > 0.
299 The thread cache is set to 0
301 rule 'Thread cache hit rate %' [thread_cache_size > 0]
302 100 - Threads_created / Connections
304 Thread cache is not efficient.
305 Increase {thread_cache_size}.
306 Thread cache hitrate: %s%, this value should be above 80% | round(value,1)
308 rule 'Threads that are slow to launch' [slow_launch_time > 0]
311 There are too many threads that are slow to launch.
312 This generally happens in case of general system overload as it is pretty simple operations. You might want to monitor your system load carefully.
313 %s thread(s) took longer than %s seconds to start, it should be 0 | value, slow_launch_time
315 rule 'Slow launch time'
318 Slow_launch_time is above 2s.
319 Set {slow_launch_time} to 1s or 2s to correctly count threads that are slow to launch.
320 slow_launch_time is set to %s | value
324 rule 'Percentage of used connections'
325 Max_used_connections / max_connections * 100
327 The maximum amount of used connections is getting close to the value of {max_connections}.
328 Increase {max_connections}, or decrease {wait_timeout} so that connections that do not close database handlers properly get killed sooner. Make sure the code closes database handlers properly.
329 Max_used_connections is at %s% of max_connections, it should be below 80% | round(value,1)
331 rule 'Percentage of aborted connections'
332 Aborted_connects / Connections * 100
334 Too many connections are aborted.
335 Connections are usually aborted when they cannot be authorized. <a href="https://www.percona.com/blog/2008/08/23/how-to-track-down-the-source-of-aborted_connects/">This article</a> might help you track down the source.
336 %s% of all connections are aborted. This value should be below 1% | round(value,1)
338 rule 'Rate of aborted connections'
339 Aborted_connects / Uptime
341 Too many connections are aborted.
342 Connections are usually aborted when they cannot be authorized. <a href="https://www.percona.com/blog/2008/08/23/how-to-track-down-the-source-of-aborted_connects/">This article</a> might help you track down the source.
343 Aborted connections rate is at %s, this value should be less than 1 per hour | ADVISOR_bytime(value,2)
345 rule 'Percentage of aborted clients'
346 Aborted_clients / Connections * 100
348 Too many clients are aborted.
349 Clients are usually aborted when they did not close their connection to MySQL properly. This can be due to network issues or code not closing a database handler properly. Check your network and code.
350 %s% of all clients are aborted. This value should be below 2% | round(value,1)
352 rule 'Rate of aborted clients'
353 Aborted_clients / Uptime
355 Too many clients are aborted.
356 Clients are usually aborted when they did not close their connection to MySQL properly. This can be due to network issues or code not closing a database handler properly. Check your network and code.
357 Aborted client rate is at %s, this value should be less than 1 per hour | ADVISOR_bytime(value,2)
361 rule 'Is InnoDB disabled?' [PMA_MYSQL_INT_VERSION < 50600]
364 You do not have InnoDB enabled.
365 InnoDB is usually the better choice for table engines.
366 have_innodb is set to 'value'
368 rule 'InnoDB log size' [innodb_buffer_pool_size > 0]
369 (innodb_log_file_size * innodb_log_files_in_group)/ innodb_buffer_pool_size * 100
370 value < 20 && innodb_log_file_size / (1024 * 1024) < 256
371 The InnoDB log file size is not an appropriate size, in relation to the InnoDB buffer pool.
372 Especially on a system with a lot of writes to InnoDB tables you should set {innodb_log_file_size} to 25% of {innodb_buffer_pool_size}. However the bigger this value, the longer the recovery time will be when database crashes, so this value should not be set much higher than 256 MiB. Please note however that you cannot simply change the value of this variable. You need to shutdown the server, remove the InnoDB log files, set the new value in my.cnf, start the server, then check the error logs if everything went fine. See also <a href="https://mysqldatabaseadministration.blogspot.com/2007/01/increase-innodblogfilesize-proper-way.html">this blog entry</a>
373 Your InnoDB log size is at %s% in relation to the InnoDB buffer pool size, it should not be below 20% | round(value,1)
375 rule 'Max InnoDB log size' [innodb_buffer_pool_size > 0 && innodb_log_file_size / innodb_buffer_pool_size * 100 < 30]
376 innodb_log_file_size / (1024 * 1024)
378 The InnoDB log file size is inadequately large.
379 It is usually sufficient to set {innodb_log_file_size} to 25% of the size of {innodb_buffer_pool_size}. A very big {innodb_log_file_size} slows down the recovery time after a database crash considerably. See also <a href="https://www.percona.com/blog/2006/07/03/choosing-proper-innodb_log_file_size/">this Article</a>. You need to shutdown the server, remove the InnoDB log files, set the new value in my.cnf, start the server, then check the error logs if everything went fine. See also <a href="https://mysqldatabaseadministration.blogspot.com/2007/01/increase-innodblogfilesize-proper-way.html">this blog entry</a>
380 Your absolute InnoDB log size is %s MiB | round(value,1)
382 rule 'InnoDB buffer pool size' [system_memory > 0]
383 innodb_buffer_pool_size / system_memory * 100
385 Your InnoDB buffer pool is fairly small.
386 The InnoDB buffer pool has a profound impact on performance for InnoDB tables. Assign all your remaining memory to this buffer. For database servers that use solely InnoDB as storage engine and have no other services (e.g. a web server) running, you may set this as high as 80% of your available memory. If that is not the case, you need to carefully assess the memory consumption of your other services and non-InnoDB-Tables and set this variable accordingly. If it is set too high, your system will start swapping, which decreases performance significantly. See also <a href="https://www.percona.com/blog/2007/11/03/choosing-innodb_buffer_pool_size/">this article</a>
387 You are currently using %s% of your memory for the InnoDB buffer pool. This rule fires if you are assigning less than 60%, however this might be perfectly adequate for your system if you don't have much InnoDB tables or other services running on the same machine. | value
391 rule 'MyISAM concurrent inserts'
393 value === 0 || value === 'NEVER'
394 Enable {concurrent_insert} by setting it to 1
395 Setting {concurrent_insert} to 1 reduces contention between readers and writers for a given table. See also <a href="https://dev.mysql.com/doc/refman/5.5/en/concurrent-inserts.html">MySQL Documentation</a>
396 concurrent_insert is set to 0
398 # INSERT DELAYED USAGE
400 #Delayed_insert_threads 0
402 #Not_flushed_delayed_rows