MySQL [mysql]> show variables like '%slow_query%'; +---------------------+-------------------------------+ | Variable_name | Value | +---------------------+-------------------------------+ | slow_query_log | ON | | slow_query_log_file | /usr/local/mysql/log/slow.log | +---------------------+-------------------------------+ 2rows in set(0.00 sec)
MySQL [mysql]> show variables like '%using_in%'; +----------------------------------------+-------+ | Variable_name | Value | +----------------------------------------+-------+ | log_queries_not_using_indexes | OFF | | log_throttle_queries_not_using_indexes | 0 | +----------------------------------------+-------+
Parse and summarize the MySQL slow query log. Options are
--verbose verbose --debug debug --help write this text to standard output
-v verbose -d debug -s ORDER what to sort by (al, at, ar, c, l, r, t), 'at' is default al: average lock time ar: average rows sent at: average query time c: count l: lock time r: rows sent t: query time -r reverse the sort order(largest last instead of first) -t NUM just show the top n queries -a don't abstract all numbers to N and strings to 'S' -n NUM abstract numbers with at least n digits within names -g PATTERN grep: only consider stmts that include this string -h HOSTNAME hostname of db server for *-slow.log filename (can be wildcard), default is '*', i.e. match all -i NAME name of server instance(ifusing mysql.server startup script) -l don't subtract lock time from total time
MySQL [mysql]> show variables like 'log_output'; +---------------+-------+ | Variable_name | Value | +---------------+-------+ | log_output | FILE | +---------------+-------+ 1row in set(0.00 sec) MySQL [mysql]> set log_output = 'TABLE'; ERROR 1229 (HY000): Variable 'log_output' is a GLOBAL variable and should be set with SET GLOBAL MySQL [mysql]> set GLOBAL log_output = 'TABLE'; Query OK, 0rows affected(0.00 sec) MySQL [mysql]> show variables like 'log_output'; +---------------+-------+ | Variable_name | Value | +---------------+-------+ | log_output | TABLE | +---------------+-------+ 1row in set(0.02 sec)