# name : response-time-distribution.patch # introduced : 12 # maintainer : Oleg # #!!! notice !!! # Any small change to this file in the main branch # should be done or reviewed by the maintainer! --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -165,7 +165,12 @@ OPTION (WITH_UNIT_TESTS "Compile MySQL with unit tests" ON) MARK_AS_ADVANCED(CYBOZU BACKUP_TEST WITHOUT_SERVER DISABLE_SHARED) - +OPTION(WITHOUT_RESPONSE_TIME_DISTRIBUTION "If we want to have response_time_distribution" OFF) +IF(WITHOUT_RESPONSE_TIME_DISTRIBUTION) +ELSE() +ADD_DEFINITIONS(-DHAVE_RESPONSE_TIME_DISTRIBUTION) +ENDIF() + OPTION(ENABLE_DEBUG_SYNC "Enable debug sync (debug builds only)" ON) IF(ENABLE_DEBUG_SYNC) SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DENABLED_DEBUG_SYNC") --- a/include/mysql_com.h +++ b/include/mysql_com.h @@ -141,10 +141,11 @@ #define REFRESH_FAST 32768 /* Intern flag */ /* RESET (remove all queries) from query cache */ -#define REFRESH_QUERY_CACHE 65536 -#define REFRESH_QUERY_CACHE_FREE 0x20000L /* pack query cache */ -#define REFRESH_DES_KEY_FILE 0x40000L -#define REFRESH_USER_RESOURCES 0x80000L +#define REFRESH_QUERY_CACHE 65536 +#define REFRESH_QUERY_CACHE_FREE 0x20000L /* pack query cache */ +#define REFRESH_DES_KEY_FILE 0x40000L +#define REFRESH_USER_RESOURCES 0x80000L +#define REFRESH_QUERY_RESPONSE_TIME 0x100000L /* response time distibution */ #define CLIENT_LONG_PASSWORD 1 /* new more secure passwords */ #define CLIENT_FOUND_ROWS 2 /* Found instead of affected rows */ --- /dev/null +++ b/mysql-test/include/have_response_time_distribution.inc @@ -0,0 +1,4 @@ +-- require r/have_response_time_distribution.require +disable_query_log; +show variables like 'have_response_time_distribution'; +enable_query_log; --- /dev/null +++ b/mysql-test/include/query_response_time.inc @@ -0,0 +1,43 @@ +SET SESSION query_exec_time=0.1; + +SET GLOBAL QUERY_RESPONSE_TIME_STATS=0; +EVAL SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=$base; +FLUSH QUERY_RESPONSE_TIME; +# Following two queries check works of FLUSH and +# respecting of "QUERY_RESPONSE_TIME_STATS" variable (see launchpad bug #855312) +SHOW QUERY_RESPONSE_TIME; +SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; +SET GLOBAL QUERY_RESPONSE_TIME_STATS=1; + +SET SESSION query_exec_time=0.31; SELECT 1; +SET SESSION query_exec_time=0.32; SELECT 1; +SET SESSION query_exec_time=0.33; SELECT 1; +SET SESSION query_exec_time=0.34; SELECT 1; +SET SESSION query_exec_time=0.35; SELECT 1; +SET SESSION query_exec_time=0.36; SELECT 1; +SET SESSION query_exec_time=0.37; SELECT 1; +SET SESSION query_exec_time=0.38; SELECT 1; +SET SESSION query_exec_time=0.39; SELECT 1; +SET SESSION query_exec_time=0.4; SELECT 1; +SET SESSION query_exec_time=1.1; SELECT 1; +SET SESSION query_exec_time=1.2; SELECT 1; +SET SESSION query_exec_time=1.3; SELECT 1; +SET SESSION query_exec_time=1.5; SELECT 1; +SET SESSION query_exec_time=1.4; SELECT 1; +SET SESSION query_exec_time=0.5; SELECT 1; +SET SESSION query_exec_time=2.1; SELECT 1; +SET SESSION query_exec_time=2.3; SELECT 1; +SET SESSION query_exec_time=2.5; SELECT 1; +SET SESSION query_exec_time=3.1; SELECT 1; +SET SESSION query_exec_time=4.1; SELECT 1; +SET SESSION query_exec_time=5.1; SELECT 1; + +SET SESSION query_exec_time=0.1; + +SET GLOBAL QUERY_RESPONSE_TIME_STATS=0; + +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; +SHOW QUERY_RESPONSE_TIME; +SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; + +SET SESSION query_exec_time=default; --- /dev/null +++ b/mysql-test/include/query_response_time-replication.inc @@ -0,0 +1,57 @@ +connection master; + +CREATE TABLE t(id INT); + +connection slave; +SET GLOBAL query_exec_time = 0.1; +--source include/restart_slave_sql.inc + +connection slave; + +SET SESSION query_exec_time=0.1; + +SET GLOBAL QUERY_RESPONSE_TIME_STATS=0; +--eval SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=$base +FLUSH QUERY_RESPONSE_TIME; +SET GLOBAL QUERY_RESPONSE_TIME_STATS=1; + +connection master; + +SET SESSION query_exec_time = 0.31; INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.32; INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.33; INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.34; INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.35; INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.36; INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.37; INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.38; INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.39; INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.4; INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 1.1; INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 1.2; INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 1.3; INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 1.5; INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 1.4; INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.5; INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 2.1; INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 2.3; INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 2.5; INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 3.1; INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 4.1; INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 5.1; INSERT INTO t VALUES(1); + +sync_slave_with_master; + +connection slave; +SET GLOBAL QUERY_RESPONSE_TIME_STATS=0; +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; +SHOW QUERY_RESPONSE_TIME; +SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; + +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=default; +SET GLOBAL QUERY_RESPONSE_TIME_STATS=default; + +connection master; +DROP TABLE t; + +sync_slave_with_master; --- /dev/null +++ b/mysql-test/include/query_response_time-stored.inc @@ -0,0 +1,37 @@ +SET SESSION query_exec_time=0.1; + +SET GLOBAL QUERY_RESPONSE_TIME_STATS=0; +EVAL SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=$base; +FLUSH QUERY_RESPONSE_TIME; +SET GLOBAL QUERY_RESPONSE_TIME_STATS=1; + +CALL test_f(0.31); +CALL test_f(0.32); +CALL test_f(0.33); +CALL test_f(0.34); +CALL test_f(0.35); +CALL test_f(0.36); +CALL test_f(0.37); +CALL test_f(0.38); +CALL test_f(0.39); +CALL test_f(0.4); +CALL test_f(1.1); +CALL test_f(1.2); +CALL test_f(1.3); +CALL test_f(1.5); +CALL test_f(1.4); +CALL test_f(0.5); +CALL test_f(2.1); +CALL test_f(2.3); +CALL test_f(2.5); +CALL test_f(3.1); +CALL test_f(4.1); +CALL test_f(5.1); + +SET GLOBAL QUERY_RESPONSE_TIME_STATS=0; + +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; +SHOW QUERY_RESPONSE_TIME; +SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; + +SET SESSION query_exec_time=default; --- /dev/null +++ b/mysql-test/r/percona_query_response_time-replication.result @@ -0,0 +1,727 @@ +SET GLOBAL query_exec_time=0.1; +include/master-slave.inc +[connection master] +CREATE TABLE t(id INT); +SET GLOBAL query_exec_time = 0.1; +include/restart_slave.inc +SET SESSION query_exec_time=0.1; +SET GLOBAL QUERY_RESPONSE_TIME_STATS=0; +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=1; +Warnings: +Warning 1292 Truncated incorrect query_response_time_range_base value: '1' +FLUSH QUERY_RESPONSE_TIME; +SET GLOBAL QUERY_RESPONSE_TIME_STATS=1; +SET SESSION query_exec_time = 0.31; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.32; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.33; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.34; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.35; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.36; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.37; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.38; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.39; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.4; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 1.1; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 1.2; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 1.3; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 1.5; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 1.4; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.5; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 2.1; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 2.3; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 2.5; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 3.1; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 4.1; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 5.1; +INSERT INTO t VALUES(1); +SET GLOBAL QUERY_RESPONSE_TIME_STATS=0; +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; +Variable_name Value +query_response_time_range_base 2 +SHOW QUERY_RESPONSE_TIME; + + 0.000001 1 0.000000 + 0.000003 0 0.000000 + 0.000007 0 0.000000 + 0.000015 0 0.000000 + 0.000030 0 0.000000 + 0.000061 0 0.000000 + 0.000122 0 0.000000 + 0.000244 0 0.000000 + 0.000488 0 0.000000 + 0.000976 0 0.000000 + 0.001953 0 0.000000 + 0.003906 0 0.000000 + 0.007812 0 0.000000 + 0.015625 0 0.000000 + 0.031250 0 0.000000 + 0.062500 0 0.000000 + 0.125000 1 0.100000 + 0.250000 0 0.000000 + 0.500000 30 10.650000 + 1.000000 3 1.500000 + 2.000000 15 19.500000 + 4.000000 12 30.000000 + 8.000000 6 27.599997 + 16.000000 0 0.000000 + 32.000000 0 0.000000 + 64.000000 0 0.000000 + 128.000000 0 0.000000 + 256.000000 0 0.000000 + 512.000000 0 0.000000 + 1024.000000 0 0.000000 + 2048.000000 0 0.000000 + 4096.000000 0 0.000000 + 8192.000000 0 0.000000 + 16384.000000 0 0.000000 + 32768.000000 0 0.000000 + 65536.000000 0 0.000000 + 131072.000000 0 0.000000 + 262144.000000 0 0.000000 + 524288.000000 0 0.000000 +1048576.000000 0 0.000000 +2097152.000000 0 0.000000 +4194304.000000 0 0.000000 +8388608.000000 0 0.000000 +TOO LONG 0 TOO LONG +SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; +time count total + 0.000001 1 0.000000 + 0.000003 0 0.000000 + 0.000007 0 0.000000 + 0.000015 0 0.000000 + 0.000030 0 0.000000 + 0.000061 0 0.000000 + 0.000122 0 0.000000 + 0.000244 0 0.000000 + 0.000488 0 0.000000 + 0.000976 0 0.000000 + 0.001953 0 0.000000 + 0.003906 0 0.000000 + 0.007812 0 0.000000 + 0.015625 0 0.000000 + 0.031250 0 0.000000 + 0.062500 0 0.000000 + 0.125000 1 0.100000 + 0.250000 0 0.000000 + 0.500000 30 10.650000 + 1.000000 3 1.500000 + 2.000000 15 19.500000 + 4.000000 12 30.000000 + 8.000000 6 27.599997 + 16.000000 0 0.000000 + 32.000000 0 0.000000 + 64.000000 0 0.000000 + 128.000000 0 0.000000 + 256.000000 0 0.000000 + 512.000000 0 0.000000 + 1024.000000 0 0.000000 + 2048.000000 0 0.000000 + 4096.000000 0 0.000000 + 8192.000000 0 0.000000 + 16384.000000 0 0.000000 + 32768.000000 0 0.000000 + 65536.000000 0 0.000000 + 131072.000000 0 0.000000 + 262144.000000 0 0.000000 + 524288.000000 0 0.000000 +1048576.000000 0 0.000000 +2097152.000000 0 0.000000 +4194304.000000 0 0.000000 +8388608.000000 0 0.000000 +TOO LONG 0 TOO LONG +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=default; +SET GLOBAL QUERY_RESPONSE_TIME_STATS=default; +DROP TABLE t; +CREATE TABLE t(id INT); +SET GLOBAL query_exec_time = 0.1; +include/restart_slave.inc +SET SESSION query_exec_time=0.1; +SET GLOBAL QUERY_RESPONSE_TIME_STATS=0; +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=2; +FLUSH QUERY_RESPONSE_TIME; +SET GLOBAL QUERY_RESPONSE_TIME_STATS=1; +SET SESSION query_exec_time = 0.31; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.32; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.33; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.34; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.35; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.36; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.37; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.38; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.39; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.4; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 1.1; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 1.2; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 1.3; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 1.5; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 1.4; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.5; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 2.1; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 2.3; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 2.5; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 3.1; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 4.1; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 5.1; +INSERT INTO t VALUES(1); +SET GLOBAL QUERY_RESPONSE_TIME_STATS=0; +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; +Variable_name Value +query_response_time_range_base 2 +SHOW QUERY_RESPONSE_TIME; + + 0.000001 1 0.000000 + 0.000003 0 0.000000 + 0.000007 0 0.000000 + 0.000015 0 0.000000 + 0.000030 0 0.000000 + 0.000061 0 0.000000 + 0.000122 0 0.000000 + 0.000244 0 0.000000 + 0.000488 0 0.000000 + 0.000976 0 0.000000 + 0.001953 0 0.000000 + 0.003906 0 0.000000 + 0.007812 0 0.000000 + 0.015625 0 0.000000 + 0.031250 0 0.000000 + 0.062500 0 0.000000 + 0.125000 1 0.100000 + 0.250000 0 0.000000 + 0.500000 30 10.650000 + 1.000000 3 1.500000 + 2.000000 15 19.500000 + 4.000000 12 30.000000 + 8.000000 6 27.599997 + 16.000000 0 0.000000 + 32.000000 0 0.000000 + 64.000000 0 0.000000 + 128.000000 0 0.000000 + 256.000000 0 0.000000 + 512.000000 0 0.000000 + 1024.000000 0 0.000000 + 2048.000000 0 0.000000 + 4096.000000 0 0.000000 + 8192.000000 0 0.000000 + 16384.000000 0 0.000000 + 32768.000000 0 0.000000 + 65536.000000 0 0.000000 + 131072.000000 0 0.000000 + 262144.000000 0 0.000000 + 524288.000000 0 0.000000 +1048576.000000 0 0.000000 +2097152.000000 0 0.000000 +4194304.000000 0 0.000000 +8388608.000000 0 0.000000 +TOO LONG 0 TOO LONG +SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; +time count total + 0.000001 1 0.000000 + 0.000003 0 0.000000 + 0.000007 0 0.000000 + 0.000015 0 0.000000 + 0.000030 0 0.000000 + 0.000061 0 0.000000 + 0.000122 0 0.000000 + 0.000244 0 0.000000 + 0.000488 0 0.000000 + 0.000976 0 0.000000 + 0.001953 0 0.000000 + 0.003906 0 0.000000 + 0.007812 0 0.000000 + 0.015625 0 0.000000 + 0.031250 0 0.000000 + 0.062500 0 0.000000 + 0.125000 1 0.100000 + 0.250000 0 0.000000 + 0.500000 30 10.650000 + 1.000000 3 1.500000 + 2.000000 15 19.500000 + 4.000000 12 30.000000 + 8.000000 6 27.599997 + 16.000000 0 0.000000 + 32.000000 0 0.000000 + 64.000000 0 0.000000 + 128.000000 0 0.000000 + 256.000000 0 0.000000 + 512.000000 0 0.000000 + 1024.000000 0 0.000000 + 2048.000000 0 0.000000 + 4096.000000 0 0.000000 + 8192.000000 0 0.000000 + 16384.000000 0 0.000000 + 32768.000000 0 0.000000 + 65536.000000 0 0.000000 + 131072.000000 0 0.000000 + 262144.000000 0 0.000000 + 524288.000000 0 0.000000 +1048576.000000 0 0.000000 +2097152.000000 0 0.000000 +4194304.000000 0 0.000000 +8388608.000000 0 0.000000 +TOO LONG 0 TOO LONG +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=default; +SET GLOBAL QUERY_RESPONSE_TIME_STATS=default; +DROP TABLE t; +CREATE TABLE t(id INT); +SET GLOBAL query_exec_time = 0.1; +include/restart_slave.inc +SET SESSION query_exec_time=0.1; +SET GLOBAL QUERY_RESPONSE_TIME_STATS=0; +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=10; +FLUSH QUERY_RESPONSE_TIME; +SET GLOBAL QUERY_RESPONSE_TIME_STATS=1; +SET SESSION query_exec_time = 0.31; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.32; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.33; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.34; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.35; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.36; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.37; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.38; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.39; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.4; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 1.1; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 1.2; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 1.3; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 1.5; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 1.4; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.5; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 2.1; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 2.3; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 2.5; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 3.1; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 4.1; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 5.1; +INSERT INTO t VALUES(1); +SET GLOBAL QUERY_RESPONSE_TIME_STATS=0; +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; +Variable_name Value +query_response_time_range_base 10 +SHOW QUERY_RESPONSE_TIME; + + 0.000001 1 0.000000 + 0.000010 0 0.000000 + 0.000100 0 0.000000 + 0.001000 0 0.000000 + 0.010000 0 0.000000 + 0.100000 0 0.000000 + 1.000000 34 12.250000 + 10.000000 33 77.099997 + 100.000000 0 0.000000 + 1000.000000 0 0.000000 + 10000.000000 0 0.000000 + 100000.000000 0 0.000000 +1000000.000000 0 0.000000 +TOO LONG 0 TOO LONG +SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; +time count total + 0.000001 1 0.000000 + 0.000010 0 0.000000 + 0.000100 0 0.000000 + 0.001000 0 0.000000 + 0.010000 0 0.000000 + 0.100000 0 0.000000 + 1.000000 34 12.250000 + 10.000000 33 77.099997 + 100.000000 0 0.000000 + 1000.000000 0 0.000000 + 10000.000000 0 0.000000 + 100000.000000 0 0.000000 +1000000.000000 0 0.000000 +TOO LONG 0 TOO LONG +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=default; +SET GLOBAL QUERY_RESPONSE_TIME_STATS=default; +DROP TABLE t; +CREATE TABLE t(id INT); +SET GLOBAL query_exec_time = 0.1; +include/restart_slave.inc +SET SESSION query_exec_time=0.1; +SET GLOBAL QUERY_RESPONSE_TIME_STATS=0; +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=7; +FLUSH QUERY_RESPONSE_TIME; +SET GLOBAL QUERY_RESPONSE_TIME_STATS=1; +SET SESSION query_exec_time = 0.31; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.32; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.33; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.34; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.35; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.36; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.37; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.38; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.39; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.4; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 1.1; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 1.2; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 1.3; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 1.5; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 1.4; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.5; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 2.1; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 2.3; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 2.5; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 3.1; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 4.1; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 5.1; +INSERT INTO t VALUES(1); +SET GLOBAL QUERY_RESPONSE_TIME_STATS=0; +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; +Variable_name Value +query_response_time_range_base 7 +SHOW QUERY_RESPONSE_TIME; + + 0.000001 1 0.000000 + 0.000008 0 0.000000 + 0.000059 0 0.000000 + 0.000416 0 0.000000 + 0.002915 0 0.000000 + 0.020408 0 0.000000 + 0.142857 1 0.100000 + 1.000000 33 12.150000 + 7.000000 33 77.099997 + 49.000000 0 0.000000 + 343.000000 0 0.000000 + 2401.000000 0 0.000000 + 16807.000000 0 0.000000 + 117649.000000 0 0.000000 + 823543.000000 0 0.000000 +5764801.000000 0 0.000000 +TOO LONG 0 TOO LONG +SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; +time count total + 0.000001 1 0.000000 + 0.000008 0 0.000000 + 0.000059 0 0.000000 + 0.000416 0 0.000000 + 0.002915 0 0.000000 + 0.020408 0 0.000000 + 0.142857 1 0.100000 + 1.000000 33 12.150000 + 7.000000 33 77.099997 + 49.000000 0 0.000000 + 343.000000 0 0.000000 + 2401.000000 0 0.000000 + 16807.000000 0 0.000000 + 117649.000000 0 0.000000 + 823543.000000 0 0.000000 +5764801.000000 0 0.000000 +TOO LONG 0 TOO LONG +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=default; +SET GLOBAL QUERY_RESPONSE_TIME_STATS=default; +DROP TABLE t; +CREATE TABLE t(id INT); +SET GLOBAL query_exec_time = 0.1; +include/restart_slave.inc +SET SESSION query_exec_time=0.1; +SET GLOBAL QUERY_RESPONSE_TIME_STATS=0; +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=156; +FLUSH QUERY_RESPONSE_TIME; +SET GLOBAL QUERY_RESPONSE_TIME_STATS=1; +SET SESSION query_exec_time = 0.31; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.32; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.33; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.34; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.35; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.36; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.37; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.38; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.39; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.4; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 1.1; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 1.2; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 1.3; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 1.5; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 1.4; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.5; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 2.1; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 2.3; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 2.5; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 3.1; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 4.1; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 5.1; +INSERT INTO t VALUES(1); +SET GLOBAL QUERY_RESPONSE_TIME_STATS=0; +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; +Variable_name Value +query_response_time_range_base 156 +SHOW QUERY_RESPONSE_TIME; + + 0.000041 1 0.000000 + 0.006410 0 0.000000 + 1.000000 34 12.250000 + 156.000000 33 77.099997 + 24336.000000 0 0.000000 +3796416.000000 0 0.000000 +TOO LONG 0 TOO LONG +SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; +time count total + 0.000041 1 0.000000 + 0.006410 0 0.000000 + 1.000000 34 12.250000 + 156.000000 33 77.099997 + 24336.000000 0 0.000000 +3796416.000000 0 0.000000 +TOO LONG 0 TOO LONG +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=default; +SET GLOBAL QUERY_RESPONSE_TIME_STATS=default; +DROP TABLE t; +CREATE TABLE t(id INT); +SET GLOBAL query_exec_time = 0.1; +include/restart_slave.inc +SET SESSION query_exec_time=0.1; +SET GLOBAL QUERY_RESPONSE_TIME_STATS=0; +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=1000; +FLUSH QUERY_RESPONSE_TIME; +SET GLOBAL QUERY_RESPONSE_TIME_STATS=1; +SET SESSION query_exec_time = 0.31; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.32; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.33; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.34; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.35; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.36; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.37; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.38; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.39; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.4; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 1.1; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 1.2; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 1.3; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 1.5; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 1.4; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.5; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 2.1; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 2.3; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 2.5; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 3.1; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 4.1; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 5.1; +INSERT INTO t VALUES(1); +SET GLOBAL QUERY_RESPONSE_TIME_STATS=0; +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; +Variable_name Value +query_response_time_range_base 1000 +SHOW QUERY_RESPONSE_TIME; + + 0.000001 1 0.000000 + 0.001000 0 0.000000 + 1.000000 34 12.250000 + 1000.000000 33 77.099997 +1000000.000000 0 0.000000 +TOO LONG 0 TOO LONG +SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; +time count total + 0.000001 1 0.000000 + 0.001000 0 0.000000 + 1.000000 34 12.250000 + 1000.000000 33 77.099997 +1000000.000000 0 0.000000 +TOO LONG 0 TOO LONG +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=default; +SET GLOBAL QUERY_RESPONSE_TIME_STATS=default; +DROP TABLE t; +CREATE TABLE t(id INT); +SET GLOBAL query_exec_time = 0.1; +include/restart_slave.inc +SET SESSION query_exec_time=0.1; +SET GLOBAL QUERY_RESPONSE_TIME_STATS=0; +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=1001; +Warnings: +Warning 1292 Truncated incorrect query_response_time_range_base value: '1001' +FLUSH QUERY_RESPONSE_TIME; +SET GLOBAL QUERY_RESPONSE_TIME_STATS=1; +SET SESSION query_exec_time = 0.31; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.32; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.33; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.34; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.35; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.36; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.37; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.38; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.39; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.4; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 1.1; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 1.2; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 1.3; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 1.5; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 1.4; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 0.5; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 2.1; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 2.3; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 2.5; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 3.1; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 4.1; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time = 5.1; +INSERT INTO t VALUES(1); +SET GLOBAL QUERY_RESPONSE_TIME_STATS=0; +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; +Variable_name Value +query_response_time_range_base 1000 +SHOW QUERY_RESPONSE_TIME; + + 0.000001 1 0.000000 + 0.001000 0 0.000000 + 1.000000 34 12.250000 + 1000.000000 33 77.099997 +1000000.000000 0 0.000000 +TOO LONG 0 TOO LONG +SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; +time count total + 0.000001 1 0.000000 + 0.001000 0 0.000000 + 1.000000 34 12.250000 + 1000.000000 33 77.099997 +1000000.000000 0 0.000000 +TOO LONG 0 TOO LONG +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=default; +SET GLOBAL QUERY_RESPONSE_TIME_STATS=default; +DROP TABLE t; +include/rpl_end.inc +SET GLOBAL query_exec_time=default; +SET GLOBAL query_exec_time=default; --- /dev/null +++ b/mysql-test/r/percona_query_response_time.result @@ -0,0 +1,1307 @@ +SET SESSION query_exec_time=0.1; +SET GLOBAL QUERY_RESPONSE_TIME_STATS=0; +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=1; +Warnings: +Warning 1292 Truncated incorrect query_response_time_range_base value: '1' +FLUSH QUERY_RESPONSE_TIME; +SHOW QUERY_RESPONSE_TIME; + + 0.000001 0 0.000000 + 0.000003 0 0.000000 + 0.000007 0 0.000000 + 0.000015 0 0.000000 + 0.000030 0 0.000000 + 0.000061 0 0.000000 + 0.000122 0 0.000000 + 0.000244 0 0.000000 + 0.000488 0 0.000000 + 0.000976 0 0.000000 + 0.001953 0 0.000000 + 0.003906 0 0.000000 + 0.007812 0 0.000000 + 0.015625 0 0.000000 + 0.031250 0 0.000000 + 0.062500 0 0.000000 + 0.125000 0 0.000000 + 0.250000 0 0.000000 + 0.500000 0 0.000000 + 1.000000 0 0.000000 + 2.000000 0 0.000000 + 4.000000 0 0.000000 + 8.000000 0 0.000000 + 16.000000 0 0.000000 + 32.000000 0 0.000000 + 64.000000 0 0.000000 + 128.000000 0 0.000000 + 256.000000 0 0.000000 + 512.000000 0 0.000000 + 1024.000000 0 0.000000 + 2048.000000 0 0.000000 + 4096.000000 0 0.000000 + 8192.000000 0 0.000000 + 16384.000000 0 0.000000 + 32768.000000 0 0.000000 + 65536.000000 0 0.000000 + 131072.000000 0 0.000000 + 262144.000000 0 0.000000 + 524288.000000 0 0.000000 +1048576.000000 0 0.000000 +2097152.000000 0 0.000000 +4194304.000000 0 0.000000 +8388608.000000 0 0.000000 +TOO LONG 0 TOO LONG +SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; +time count total + 0.000001 0 0.000000 + 0.000003 0 0.000000 + 0.000007 0 0.000000 + 0.000015 0 0.000000 + 0.000030 0 0.000000 + 0.000061 0 0.000000 + 0.000122 0 0.000000 + 0.000244 0 0.000000 + 0.000488 0 0.000000 + 0.000976 0 0.000000 + 0.001953 0 0.000000 + 0.003906 0 0.000000 + 0.007812 0 0.000000 + 0.015625 0 0.000000 + 0.031250 0 0.000000 + 0.062500 0 0.000000 + 0.125000 0 0.000000 + 0.250000 0 0.000000 + 0.500000 0 0.000000 + 1.000000 0 0.000000 + 2.000000 0 0.000000 + 4.000000 0 0.000000 + 8.000000 0 0.000000 + 16.000000 0 0.000000 + 32.000000 0 0.000000 + 64.000000 0 0.000000 + 128.000000 0 0.000000 + 256.000000 0 0.000000 + 512.000000 0 0.000000 + 1024.000000 0 0.000000 + 2048.000000 0 0.000000 + 4096.000000 0 0.000000 + 8192.000000 0 0.000000 + 16384.000000 0 0.000000 + 32768.000000 0 0.000000 + 65536.000000 0 0.000000 + 131072.000000 0 0.000000 + 262144.000000 0 0.000000 + 524288.000000 0 0.000000 +1048576.000000 0 0.000000 +2097152.000000 0 0.000000 +4194304.000000 0 0.000000 +8388608.000000 0 0.000000 +TOO LONG 0 TOO LONG +SET GLOBAL QUERY_RESPONSE_TIME_STATS=1; +SET SESSION query_exec_time=0.31; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.32; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.33; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.34; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.35; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.36; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.37; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.38; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.39; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.4; +SELECT 1; +1 +1 +SET SESSION query_exec_time=1.1; +SELECT 1; +1 +1 +SET SESSION query_exec_time=1.2; +SELECT 1; +1 +1 +SET SESSION query_exec_time=1.3; +SELECT 1; +1 +1 +SET SESSION query_exec_time=1.5; +SELECT 1; +1 +1 +SET SESSION query_exec_time=1.4; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.5; +SELECT 1; +1 +1 +SET SESSION query_exec_time=2.1; +SELECT 1; +1 +1 +SET SESSION query_exec_time=2.3; +SELECT 1; +1 +1 +SET SESSION query_exec_time=2.5; +SELECT 1; +1 +1 +SET SESSION query_exec_time=3.1; +SELECT 1; +1 +1 +SET SESSION query_exec_time=4.1; +SELECT 1; +1 +1 +SET SESSION query_exec_time=5.1; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.1; +SET GLOBAL QUERY_RESPONSE_TIME_STATS=0; +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; +Variable_name Value +query_response_time_range_base 2 +SHOW QUERY_RESPONSE_TIME; + + 0.000001 24 0.000000 + 0.000003 0 0.000000 + 0.000007 0 0.000000 + 0.000015 0 0.000000 + 0.000030 0 0.000000 + 0.000061 0 0.000000 + 0.000122 0 0.000000 + 0.000244 0 0.000000 + 0.000488 0 0.000000 + 0.000976 0 0.000000 + 0.001953 0 0.000000 + 0.003906 0 0.000000 + 0.007812 0 0.000000 + 0.015625 0 0.000000 + 0.031250 0 0.000000 + 0.062500 0 0.000000 + 0.125000 0 0.000000 + 0.250000 0 0.000000 + 0.500000 10 3.550000 + 1.000000 1 0.500000 + 2.000000 5 6.500000 + 4.000000 4 10.000000 + 8.000000 2 9.199999 + 16.000000 0 0.000000 + 32.000000 0 0.000000 + 64.000000 0 0.000000 + 128.000000 0 0.000000 + 256.000000 0 0.000000 + 512.000000 0 0.000000 + 1024.000000 0 0.000000 + 2048.000000 0 0.000000 + 4096.000000 0 0.000000 + 8192.000000 0 0.000000 + 16384.000000 0 0.000000 + 32768.000000 0 0.000000 + 65536.000000 0 0.000000 + 131072.000000 0 0.000000 + 262144.000000 0 0.000000 + 524288.000000 0 0.000000 +1048576.000000 0 0.000000 +2097152.000000 0 0.000000 +4194304.000000 0 0.000000 +8388608.000000 0 0.000000 +TOO LONG 0 TOO LONG +SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; +time count total + 0.000001 24 0.000000 + 0.000003 0 0.000000 + 0.000007 0 0.000000 + 0.000015 0 0.000000 + 0.000030 0 0.000000 + 0.000061 0 0.000000 + 0.000122 0 0.000000 + 0.000244 0 0.000000 + 0.000488 0 0.000000 + 0.000976 0 0.000000 + 0.001953 0 0.000000 + 0.003906 0 0.000000 + 0.007812 0 0.000000 + 0.015625 0 0.000000 + 0.031250 0 0.000000 + 0.062500 0 0.000000 + 0.125000 0 0.000000 + 0.250000 0 0.000000 + 0.500000 10 3.550000 + 1.000000 1 0.500000 + 2.000000 5 6.500000 + 4.000000 4 10.000000 + 8.000000 2 9.199999 + 16.000000 0 0.000000 + 32.000000 0 0.000000 + 64.000000 0 0.000000 + 128.000000 0 0.000000 + 256.000000 0 0.000000 + 512.000000 0 0.000000 + 1024.000000 0 0.000000 + 2048.000000 0 0.000000 + 4096.000000 0 0.000000 + 8192.000000 0 0.000000 + 16384.000000 0 0.000000 + 32768.000000 0 0.000000 + 65536.000000 0 0.000000 + 131072.000000 0 0.000000 + 262144.000000 0 0.000000 + 524288.000000 0 0.000000 +1048576.000000 0 0.000000 +2097152.000000 0 0.000000 +4194304.000000 0 0.000000 +8388608.000000 0 0.000000 +TOO LONG 0 TOO LONG +SET SESSION query_exec_time=default; +SET SESSION query_exec_time=0.1; +SET GLOBAL QUERY_RESPONSE_TIME_STATS=0; +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=2; +FLUSH QUERY_RESPONSE_TIME; +SHOW QUERY_RESPONSE_TIME; + + 0.000001 0 0.000000 + 0.000003 0 0.000000 + 0.000007 0 0.000000 + 0.000015 0 0.000000 + 0.000030 0 0.000000 + 0.000061 0 0.000000 + 0.000122 0 0.000000 + 0.000244 0 0.000000 + 0.000488 0 0.000000 + 0.000976 0 0.000000 + 0.001953 0 0.000000 + 0.003906 0 0.000000 + 0.007812 0 0.000000 + 0.015625 0 0.000000 + 0.031250 0 0.000000 + 0.062500 0 0.000000 + 0.125000 0 0.000000 + 0.250000 0 0.000000 + 0.500000 0 0.000000 + 1.000000 0 0.000000 + 2.000000 0 0.000000 + 4.000000 0 0.000000 + 8.000000 0 0.000000 + 16.000000 0 0.000000 + 32.000000 0 0.000000 + 64.000000 0 0.000000 + 128.000000 0 0.000000 + 256.000000 0 0.000000 + 512.000000 0 0.000000 + 1024.000000 0 0.000000 + 2048.000000 0 0.000000 + 4096.000000 0 0.000000 + 8192.000000 0 0.000000 + 16384.000000 0 0.000000 + 32768.000000 0 0.000000 + 65536.000000 0 0.000000 + 131072.000000 0 0.000000 + 262144.000000 0 0.000000 + 524288.000000 0 0.000000 +1048576.000000 0 0.000000 +2097152.000000 0 0.000000 +4194304.000000 0 0.000000 +8388608.000000 0 0.000000 +TOO LONG 0 TOO LONG +SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; +time count total + 0.000001 0 0.000000 + 0.000003 0 0.000000 + 0.000007 0 0.000000 + 0.000015 0 0.000000 + 0.000030 0 0.000000 + 0.000061 0 0.000000 + 0.000122 0 0.000000 + 0.000244 0 0.000000 + 0.000488 0 0.000000 + 0.000976 0 0.000000 + 0.001953 0 0.000000 + 0.003906 0 0.000000 + 0.007812 0 0.000000 + 0.015625 0 0.000000 + 0.031250 0 0.000000 + 0.062500 0 0.000000 + 0.125000 0 0.000000 + 0.250000 0 0.000000 + 0.500000 0 0.000000 + 1.000000 0 0.000000 + 2.000000 0 0.000000 + 4.000000 0 0.000000 + 8.000000 0 0.000000 + 16.000000 0 0.000000 + 32.000000 0 0.000000 + 64.000000 0 0.000000 + 128.000000 0 0.000000 + 256.000000 0 0.000000 + 512.000000 0 0.000000 + 1024.000000 0 0.000000 + 2048.000000 0 0.000000 + 4096.000000 0 0.000000 + 8192.000000 0 0.000000 + 16384.000000 0 0.000000 + 32768.000000 0 0.000000 + 65536.000000 0 0.000000 + 131072.000000 0 0.000000 + 262144.000000 0 0.000000 + 524288.000000 0 0.000000 +1048576.000000 0 0.000000 +2097152.000000 0 0.000000 +4194304.000000 0 0.000000 +8388608.000000 0 0.000000 +TOO LONG 0 TOO LONG +SET GLOBAL QUERY_RESPONSE_TIME_STATS=1; +SET SESSION query_exec_time=0.31; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.32; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.33; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.34; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.35; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.36; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.37; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.38; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.39; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.4; +SELECT 1; +1 +1 +SET SESSION query_exec_time=1.1; +SELECT 1; +1 +1 +SET SESSION query_exec_time=1.2; +SELECT 1; +1 +1 +SET SESSION query_exec_time=1.3; +SELECT 1; +1 +1 +SET SESSION query_exec_time=1.5; +SELECT 1; +1 +1 +SET SESSION query_exec_time=1.4; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.5; +SELECT 1; +1 +1 +SET SESSION query_exec_time=2.1; +SELECT 1; +1 +1 +SET SESSION query_exec_time=2.3; +SELECT 1; +1 +1 +SET SESSION query_exec_time=2.5; +SELECT 1; +1 +1 +SET SESSION query_exec_time=3.1; +SELECT 1; +1 +1 +SET SESSION query_exec_time=4.1; +SELECT 1; +1 +1 +SET SESSION query_exec_time=5.1; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.1; +SET GLOBAL QUERY_RESPONSE_TIME_STATS=0; +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; +Variable_name Value +query_response_time_range_base 2 +SHOW QUERY_RESPONSE_TIME; + + 0.000001 24 0.000000 + 0.000003 0 0.000000 + 0.000007 0 0.000000 + 0.000015 0 0.000000 + 0.000030 0 0.000000 + 0.000061 0 0.000000 + 0.000122 0 0.000000 + 0.000244 0 0.000000 + 0.000488 0 0.000000 + 0.000976 0 0.000000 + 0.001953 0 0.000000 + 0.003906 0 0.000000 + 0.007812 0 0.000000 + 0.015625 0 0.000000 + 0.031250 0 0.000000 + 0.062500 0 0.000000 + 0.125000 0 0.000000 + 0.250000 0 0.000000 + 0.500000 10 3.550000 + 1.000000 1 0.500000 + 2.000000 5 6.500000 + 4.000000 4 10.000000 + 8.000000 2 9.199999 + 16.000000 0 0.000000 + 32.000000 0 0.000000 + 64.000000 0 0.000000 + 128.000000 0 0.000000 + 256.000000 0 0.000000 + 512.000000 0 0.000000 + 1024.000000 0 0.000000 + 2048.000000 0 0.000000 + 4096.000000 0 0.000000 + 8192.000000 0 0.000000 + 16384.000000 0 0.000000 + 32768.000000 0 0.000000 + 65536.000000 0 0.000000 + 131072.000000 0 0.000000 + 262144.000000 0 0.000000 + 524288.000000 0 0.000000 +1048576.000000 0 0.000000 +2097152.000000 0 0.000000 +4194304.000000 0 0.000000 +8388608.000000 0 0.000000 +TOO LONG 0 TOO LONG +SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; +time count total + 0.000001 24 0.000000 + 0.000003 0 0.000000 + 0.000007 0 0.000000 + 0.000015 0 0.000000 + 0.000030 0 0.000000 + 0.000061 0 0.000000 + 0.000122 0 0.000000 + 0.000244 0 0.000000 + 0.000488 0 0.000000 + 0.000976 0 0.000000 + 0.001953 0 0.000000 + 0.003906 0 0.000000 + 0.007812 0 0.000000 + 0.015625 0 0.000000 + 0.031250 0 0.000000 + 0.062500 0 0.000000 + 0.125000 0 0.000000 + 0.250000 0 0.000000 + 0.500000 10 3.550000 + 1.000000 1 0.500000 + 2.000000 5 6.500000 + 4.000000 4 10.000000 + 8.000000 2 9.199999 + 16.000000 0 0.000000 + 32.000000 0 0.000000 + 64.000000 0 0.000000 + 128.000000 0 0.000000 + 256.000000 0 0.000000 + 512.000000 0 0.000000 + 1024.000000 0 0.000000 + 2048.000000 0 0.000000 + 4096.000000 0 0.000000 + 8192.000000 0 0.000000 + 16384.000000 0 0.000000 + 32768.000000 0 0.000000 + 65536.000000 0 0.000000 + 131072.000000 0 0.000000 + 262144.000000 0 0.000000 + 524288.000000 0 0.000000 +1048576.000000 0 0.000000 +2097152.000000 0 0.000000 +4194304.000000 0 0.000000 +8388608.000000 0 0.000000 +TOO LONG 0 TOO LONG +SET SESSION query_exec_time=default; +SET SESSION query_exec_time=0.1; +SET GLOBAL QUERY_RESPONSE_TIME_STATS=0; +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=10; +FLUSH QUERY_RESPONSE_TIME; +SHOW QUERY_RESPONSE_TIME; + + 0.000001 0 0.000000 + 0.000010 0 0.000000 + 0.000100 0 0.000000 + 0.001000 0 0.000000 + 0.010000 0 0.000000 + 0.100000 0 0.000000 + 1.000000 0 0.000000 + 10.000000 0 0.000000 + 100.000000 0 0.000000 + 1000.000000 0 0.000000 + 10000.000000 0 0.000000 + 100000.000000 0 0.000000 +1000000.000000 0 0.000000 +TOO LONG 0 TOO LONG +SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; +time count total + 0.000001 0 0.000000 + 0.000010 0 0.000000 + 0.000100 0 0.000000 + 0.001000 0 0.000000 + 0.010000 0 0.000000 + 0.100000 0 0.000000 + 1.000000 0 0.000000 + 10.000000 0 0.000000 + 100.000000 0 0.000000 + 1000.000000 0 0.000000 + 10000.000000 0 0.000000 + 100000.000000 0 0.000000 +1000000.000000 0 0.000000 +TOO LONG 0 TOO LONG +SET GLOBAL QUERY_RESPONSE_TIME_STATS=1; +SET SESSION query_exec_time=0.31; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.32; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.33; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.34; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.35; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.36; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.37; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.38; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.39; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.4; +SELECT 1; +1 +1 +SET SESSION query_exec_time=1.1; +SELECT 1; +1 +1 +SET SESSION query_exec_time=1.2; +SELECT 1; +1 +1 +SET SESSION query_exec_time=1.3; +SELECT 1; +1 +1 +SET SESSION query_exec_time=1.5; +SELECT 1; +1 +1 +SET SESSION query_exec_time=1.4; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.5; +SELECT 1; +1 +1 +SET SESSION query_exec_time=2.1; +SELECT 1; +1 +1 +SET SESSION query_exec_time=2.3; +SELECT 1; +1 +1 +SET SESSION query_exec_time=2.5; +SELECT 1; +1 +1 +SET SESSION query_exec_time=3.1; +SELECT 1; +1 +1 +SET SESSION query_exec_time=4.1; +SELECT 1; +1 +1 +SET SESSION query_exec_time=5.1; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.1; +SET GLOBAL QUERY_RESPONSE_TIME_STATS=0; +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; +Variable_name Value +query_response_time_range_base 10 +SHOW QUERY_RESPONSE_TIME; + + 0.000001 24 0.000000 + 0.000010 0 0.000000 + 0.000100 0 0.000000 + 0.001000 0 0.000000 + 0.010000 0 0.000000 + 0.100000 0 0.000000 + 1.000000 11 4.050000 + 10.000000 11 25.699999 + 100.000000 0 0.000000 + 1000.000000 0 0.000000 + 10000.000000 0 0.000000 + 100000.000000 0 0.000000 +1000000.000000 0 0.000000 +TOO LONG 0 TOO LONG +SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; +time count total + 0.000001 24 0.000000 + 0.000010 0 0.000000 + 0.000100 0 0.000000 + 0.001000 0 0.000000 + 0.010000 0 0.000000 + 0.100000 0 0.000000 + 1.000000 11 4.050000 + 10.000000 11 25.699999 + 100.000000 0 0.000000 + 1000.000000 0 0.000000 + 10000.000000 0 0.000000 + 100000.000000 0 0.000000 +1000000.000000 0 0.000000 +TOO LONG 0 TOO LONG +SET SESSION query_exec_time=default; +SET SESSION query_exec_time=0.1; +SET GLOBAL QUERY_RESPONSE_TIME_STATS=0; +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=7; +FLUSH QUERY_RESPONSE_TIME; +SHOW QUERY_RESPONSE_TIME; + + 0.000001 0 0.000000 + 0.000008 0 0.000000 + 0.000059 0 0.000000 + 0.000416 0 0.000000 + 0.002915 0 0.000000 + 0.020408 0 0.000000 + 0.142857 0 0.000000 + 1.000000 0 0.000000 + 7.000000 0 0.000000 + 49.000000 0 0.000000 + 343.000000 0 0.000000 + 2401.000000 0 0.000000 + 16807.000000 0 0.000000 + 117649.000000 0 0.000000 + 823543.000000 0 0.000000 +5764801.000000 0 0.000000 +TOO LONG 0 TOO LONG +SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; +time count total + 0.000001 0 0.000000 + 0.000008 0 0.000000 + 0.000059 0 0.000000 + 0.000416 0 0.000000 + 0.002915 0 0.000000 + 0.020408 0 0.000000 + 0.142857 0 0.000000 + 1.000000 0 0.000000 + 7.000000 0 0.000000 + 49.000000 0 0.000000 + 343.000000 0 0.000000 + 2401.000000 0 0.000000 + 16807.000000 0 0.000000 + 117649.000000 0 0.000000 + 823543.000000 0 0.000000 +5764801.000000 0 0.000000 +TOO LONG 0 TOO LONG +SET GLOBAL QUERY_RESPONSE_TIME_STATS=1; +SET SESSION query_exec_time=0.31; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.32; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.33; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.34; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.35; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.36; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.37; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.38; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.39; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.4; +SELECT 1; +1 +1 +SET SESSION query_exec_time=1.1; +SELECT 1; +1 +1 +SET SESSION query_exec_time=1.2; +SELECT 1; +1 +1 +SET SESSION query_exec_time=1.3; +SELECT 1; +1 +1 +SET SESSION query_exec_time=1.5; +SELECT 1; +1 +1 +SET SESSION query_exec_time=1.4; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.5; +SELECT 1; +1 +1 +SET SESSION query_exec_time=2.1; +SELECT 1; +1 +1 +SET SESSION query_exec_time=2.3; +SELECT 1; +1 +1 +SET SESSION query_exec_time=2.5; +SELECT 1; +1 +1 +SET SESSION query_exec_time=3.1; +SELECT 1; +1 +1 +SET SESSION query_exec_time=4.1; +SELECT 1; +1 +1 +SET SESSION query_exec_time=5.1; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.1; +SET GLOBAL QUERY_RESPONSE_TIME_STATS=0; +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; +Variable_name Value +query_response_time_range_base 7 +SHOW QUERY_RESPONSE_TIME; + + 0.000001 24 0.000000 + 0.000008 0 0.000000 + 0.000059 0 0.000000 + 0.000416 0 0.000000 + 0.002915 0 0.000000 + 0.020408 0 0.000000 + 0.142857 0 0.000000 + 1.000000 11 4.050000 + 7.000000 11 25.699999 + 49.000000 0 0.000000 + 343.000000 0 0.000000 + 2401.000000 0 0.000000 + 16807.000000 0 0.000000 + 117649.000000 0 0.000000 + 823543.000000 0 0.000000 +5764801.000000 0 0.000000 +TOO LONG 0 TOO LONG +SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; +time count total + 0.000001 24 0.000000 + 0.000008 0 0.000000 + 0.000059 0 0.000000 + 0.000416 0 0.000000 + 0.002915 0 0.000000 + 0.020408 0 0.000000 + 0.142857 0 0.000000 + 1.000000 11 4.050000 + 7.000000 11 25.699999 + 49.000000 0 0.000000 + 343.000000 0 0.000000 + 2401.000000 0 0.000000 + 16807.000000 0 0.000000 + 117649.000000 0 0.000000 + 823543.000000 0 0.000000 +5764801.000000 0 0.000000 +TOO LONG 0 TOO LONG +SET SESSION query_exec_time=default; +SET SESSION query_exec_time=0.1; +SET GLOBAL QUERY_RESPONSE_TIME_STATS=0; +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=156; +FLUSH QUERY_RESPONSE_TIME; +SHOW QUERY_RESPONSE_TIME; + + 0.000041 0 0.000000 + 0.006410 0 0.000000 + 1.000000 0 0.000000 + 156.000000 0 0.000000 + 24336.000000 0 0.000000 +3796416.000000 0 0.000000 +TOO LONG 0 TOO LONG +SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; +time count total + 0.000041 0 0.000000 + 0.006410 0 0.000000 + 1.000000 0 0.000000 + 156.000000 0 0.000000 + 24336.000000 0 0.000000 +3796416.000000 0 0.000000 +TOO LONG 0 TOO LONG +SET GLOBAL QUERY_RESPONSE_TIME_STATS=1; +SET SESSION query_exec_time=0.31; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.32; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.33; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.34; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.35; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.36; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.37; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.38; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.39; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.4; +SELECT 1; +1 +1 +SET SESSION query_exec_time=1.1; +SELECT 1; +1 +1 +SET SESSION query_exec_time=1.2; +SELECT 1; +1 +1 +SET SESSION query_exec_time=1.3; +SELECT 1; +1 +1 +SET SESSION query_exec_time=1.5; +SELECT 1; +1 +1 +SET SESSION query_exec_time=1.4; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.5; +SELECT 1; +1 +1 +SET SESSION query_exec_time=2.1; +SELECT 1; +1 +1 +SET SESSION query_exec_time=2.3; +SELECT 1; +1 +1 +SET SESSION query_exec_time=2.5; +SELECT 1; +1 +1 +SET SESSION query_exec_time=3.1; +SELECT 1; +1 +1 +SET SESSION query_exec_time=4.1; +SELECT 1; +1 +1 +SET SESSION query_exec_time=5.1; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.1; +SET GLOBAL QUERY_RESPONSE_TIME_STATS=0; +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; +Variable_name Value +query_response_time_range_base 156 +SHOW QUERY_RESPONSE_TIME; + + 0.000041 24 0.000000 + 0.006410 0 0.000000 + 1.000000 11 4.050000 + 156.000000 11 25.699999 + 24336.000000 0 0.000000 +3796416.000000 0 0.000000 +TOO LONG 0 TOO LONG +SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; +time count total + 0.000041 24 0.000000 + 0.006410 0 0.000000 + 1.000000 11 4.050000 + 156.000000 11 25.699999 + 24336.000000 0 0.000000 +3796416.000000 0 0.000000 +TOO LONG 0 TOO LONG +SET SESSION query_exec_time=default; +SET SESSION query_exec_time=0.1; +SET GLOBAL QUERY_RESPONSE_TIME_STATS=0; +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=1000; +FLUSH QUERY_RESPONSE_TIME; +SHOW QUERY_RESPONSE_TIME; + + 0.000001 0 0.000000 + 0.001000 0 0.000000 + 1.000000 0 0.000000 + 1000.000000 0 0.000000 +1000000.000000 0 0.000000 +TOO LONG 0 TOO LONG +SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; +time count total + 0.000001 0 0.000000 + 0.001000 0 0.000000 + 1.000000 0 0.000000 + 1000.000000 0 0.000000 +1000000.000000 0 0.000000 +TOO LONG 0 TOO LONG +SET GLOBAL QUERY_RESPONSE_TIME_STATS=1; +SET SESSION query_exec_time=0.31; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.32; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.33; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.34; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.35; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.36; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.37; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.38; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.39; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.4; +SELECT 1; +1 +1 +SET SESSION query_exec_time=1.1; +SELECT 1; +1 +1 +SET SESSION query_exec_time=1.2; +SELECT 1; +1 +1 +SET SESSION query_exec_time=1.3; +SELECT 1; +1 +1 +SET SESSION query_exec_time=1.5; +SELECT 1; +1 +1 +SET SESSION query_exec_time=1.4; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.5; +SELECT 1; +1 +1 +SET SESSION query_exec_time=2.1; +SELECT 1; +1 +1 +SET SESSION query_exec_time=2.3; +SELECT 1; +1 +1 +SET SESSION query_exec_time=2.5; +SELECT 1; +1 +1 +SET SESSION query_exec_time=3.1; +SELECT 1; +1 +1 +SET SESSION query_exec_time=4.1; +SELECT 1; +1 +1 +SET SESSION query_exec_time=5.1; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.1; +SET GLOBAL QUERY_RESPONSE_TIME_STATS=0; +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; +Variable_name Value +query_response_time_range_base 1000 +SHOW QUERY_RESPONSE_TIME; + + 0.000001 24 0.000000 + 0.001000 0 0.000000 + 1.000000 11 4.050000 + 1000.000000 11 25.699999 +1000000.000000 0 0.000000 +TOO LONG 0 TOO LONG +SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; +time count total + 0.000001 24 0.000000 + 0.001000 0 0.000000 + 1.000000 11 4.050000 + 1000.000000 11 25.699999 +1000000.000000 0 0.000000 +TOO LONG 0 TOO LONG +SET SESSION query_exec_time=default; +SET SESSION query_exec_time=0.1; +SET GLOBAL QUERY_RESPONSE_TIME_STATS=0; +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=1001; +Warnings: +Warning 1292 Truncated incorrect query_response_time_range_base value: '1001' +FLUSH QUERY_RESPONSE_TIME; +SHOW QUERY_RESPONSE_TIME; + + 0.000001 0 0.000000 + 0.001000 0 0.000000 + 1.000000 0 0.000000 + 1000.000000 0 0.000000 +1000000.000000 0 0.000000 +TOO LONG 0 TOO LONG +SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; +time count total + 0.000001 0 0.000000 + 0.001000 0 0.000000 + 1.000000 0 0.000000 + 1000.000000 0 0.000000 +1000000.000000 0 0.000000 +TOO LONG 0 TOO LONG +SET GLOBAL QUERY_RESPONSE_TIME_STATS=1; +SET SESSION query_exec_time=0.31; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.32; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.33; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.34; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.35; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.36; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.37; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.38; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.39; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.4; +SELECT 1; +1 +1 +SET SESSION query_exec_time=1.1; +SELECT 1; +1 +1 +SET SESSION query_exec_time=1.2; +SELECT 1; +1 +1 +SET SESSION query_exec_time=1.3; +SELECT 1; +1 +1 +SET SESSION query_exec_time=1.5; +SELECT 1; +1 +1 +SET SESSION query_exec_time=1.4; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.5; +SELECT 1; +1 +1 +SET SESSION query_exec_time=2.1; +SELECT 1; +1 +1 +SET SESSION query_exec_time=2.3; +SELECT 1; +1 +1 +SET SESSION query_exec_time=2.5; +SELECT 1; +1 +1 +SET SESSION query_exec_time=3.1; +SELECT 1; +1 +1 +SET SESSION query_exec_time=4.1; +SELECT 1; +1 +1 +SET SESSION query_exec_time=5.1; +SELECT 1; +1 +1 +SET SESSION query_exec_time=0.1; +SET GLOBAL QUERY_RESPONSE_TIME_STATS=0; +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; +Variable_name Value +query_response_time_range_base 1000 +SHOW QUERY_RESPONSE_TIME; + + 0.000001 24 0.000000 + 0.001000 0 0.000000 + 1.000000 11 4.050000 + 1000.000000 11 25.699999 +1000000.000000 0 0.000000 +TOO LONG 0 TOO LONG +SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; +time count total + 0.000001 24 0.000000 + 0.001000 0 0.000000 + 1.000000 11 4.050000 + 1000.000000 11 25.699999 +1000000.000000 0 0.000000 +TOO LONG 0 TOO LONG +SET SESSION query_exec_time=default; +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=default; +SET GLOBAL QUERY_RESPONSE_TIME_STATS=default; --- /dev/null +++ b/mysql-test/r/percona_query_response_time-stored.result @@ -0,0 +1,544 @@ +CREATE TABLE t(a INT); +CREATE PROCEDURE test_f(t DECIMAL(3,2)) +BEGIN +SET SESSION query_exec_time=t; +INSERT INTO t VALUES(1); +SET SESSION query_exec_time=0.1; +DELETE FROM t; +END^ +SET SESSION query_exec_time=0.1; +SET GLOBAL QUERY_RESPONSE_TIME_STATS=0; +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=1; +Warnings: +Warning 1292 Truncated incorrect query_response_time_range_base value: '1' +FLUSH QUERY_RESPONSE_TIME; +SET GLOBAL QUERY_RESPONSE_TIME_STATS=1; +CALL test_f(0.31); +CALL test_f(0.32); +CALL test_f(0.33); +CALL test_f(0.34); +CALL test_f(0.35); +CALL test_f(0.36); +CALL test_f(0.37); +CALL test_f(0.38); +CALL test_f(0.39); +CALL test_f(0.4); +CALL test_f(1.1); +CALL test_f(1.2); +CALL test_f(1.3); +CALL test_f(1.5); +CALL test_f(1.4); +CALL test_f(0.5); +CALL test_f(2.1); +CALL test_f(2.3); +CALL test_f(2.5); +CALL test_f(3.1); +CALL test_f(4.1); +CALL test_f(5.1); +SET GLOBAL QUERY_RESPONSE_TIME_STATS=0; +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; +Variable_name Value +query_response_time_range_base 2 +SHOW QUERY_RESPONSE_TIME; + + 0.000001 45 0.000000 + 0.000003 0 0.000000 + 0.000007 0 0.000000 + 0.000015 0 0.000000 + 0.000030 0 0.000000 + 0.000061 0 0.000000 + 0.000122 0 0.000000 + 0.000244 0 0.000000 + 0.000488 0 0.000000 + 0.000976 0 0.000000 + 0.001953 0 0.000000 + 0.003906 0 0.000000 + 0.007812 0 0.000000 + 0.015625 0 0.000000 + 0.031250 0 0.000000 + 0.062500 0 0.000000 + 0.125000 44 4.400000 + 0.250000 0 0.000000 + 0.500000 10 3.550000 + 1.000000 1 0.500000 + 2.000000 5 6.500000 + 4.000000 4 10.000000 + 8.000000 2 9.199999 + 16.000000 0 0.000000 + 32.000000 0 0.000000 + 64.000000 0 0.000000 + 128.000000 0 0.000000 + 256.000000 0 0.000000 + 512.000000 0 0.000000 + 1024.000000 0 0.000000 + 2048.000000 0 0.000000 + 4096.000000 0 0.000000 + 8192.000000 0 0.000000 + 16384.000000 0 0.000000 + 32768.000000 0 0.000000 + 65536.000000 0 0.000000 + 131072.000000 0 0.000000 + 262144.000000 0 0.000000 + 524288.000000 0 0.000000 +1048576.000000 0 0.000000 +2097152.000000 0 0.000000 +4194304.000000 0 0.000000 +8388608.000000 0 0.000000 +TOO LONG 0 TOO LONG +SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; +time count total + 0.000001 45 0.000000 + 0.000003 0 0.000000 + 0.000007 0 0.000000 + 0.000015 0 0.000000 + 0.000030 0 0.000000 + 0.000061 0 0.000000 + 0.000122 0 0.000000 + 0.000244 0 0.000000 + 0.000488 0 0.000000 + 0.000976 0 0.000000 + 0.001953 0 0.000000 + 0.003906 0 0.000000 + 0.007812 0 0.000000 + 0.015625 0 0.000000 + 0.031250 0 0.000000 + 0.062500 0 0.000000 + 0.125000 44 4.400000 + 0.250000 0 0.000000 + 0.500000 10 3.550000 + 1.000000 1 0.500000 + 2.000000 5 6.500000 + 4.000000 4 10.000000 + 8.000000 2 9.199999 + 16.000000 0 0.000000 + 32.000000 0 0.000000 + 64.000000 0 0.000000 + 128.000000 0 0.000000 + 256.000000 0 0.000000 + 512.000000 0 0.000000 + 1024.000000 0 0.000000 + 2048.000000 0 0.000000 + 4096.000000 0 0.000000 + 8192.000000 0 0.000000 + 16384.000000 0 0.000000 + 32768.000000 0 0.000000 + 65536.000000 0 0.000000 + 131072.000000 0 0.000000 + 262144.000000 0 0.000000 + 524288.000000 0 0.000000 +1048576.000000 0 0.000000 +2097152.000000 0 0.000000 +4194304.000000 0 0.000000 +8388608.000000 0 0.000000 +TOO LONG 0 TOO LONG +SET SESSION query_exec_time=default; +SET SESSION query_exec_time=0.1; +SET GLOBAL QUERY_RESPONSE_TIME_STATS=0; +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=2; +FLUSH QUERY_RESPONSE_TIME; +SET GLOBAL QUERY_RESPONSE_TIME_STATS=1; +CALL test_f(0.31); +CALL test_f(0.32); +CALL test_f(0.33); +CALL test_f(0.34); +CALL test_f(0.35); +CALL test_f(0.36); +CALL test_f(0.37); +CALL test_f(0.38); +CALL test_f(0.39); +CALL test_f(0.4); +CALL test_f(1.1); +CALL test_f(1.2); +CALL test_f(1.3); +CALL test_f(1.5); +CALL test_f(1.4); +CALL test_f(0.5); +CALL test_f(2.1); +CALL test_f(2.3); +CALL test_f(2.5); +CALL test_f(3.1); +CALL test_f(4.1); +CALL test_f(5.1); +SET GLOBAL QUERY_RESPONSE_TIME_STATS=0; +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; +Variable_name Value +query_response_time_range_base 2 +SHOW QUERY_RESPONSE_TIME; + + 0.000001 45 0.000000 + 0.000003 0 0.000000 + 0.000007 0 0.000000 + 0.000015 0 0.000000 + 0.000030 0 0.000000 + 0.000061 0 0.000000 + 0.000122 0 0.000000 + 0.000244 0 0.000000 + 0.000488 0 0.000000 + 0.000976 0 0.000000 + 0.001953 0 0.000000 + 0.003906 0 0.000000 + 0.007812 0 0.000000 + 0.015625 0 0.000000 + 0.031250 0 0.000000 + 0.062500 0 0.000000 + 0.125000 44 4.400000 + 0.250000 0 0.000000 + 0.500000 10 3.550000 + 1.000000 1 0.500000 + 2.000000 5 6.500000 + 4.000000 4 10.000000 + 8.000000 2 9.199999 + 16.000000 0 0.000000 + 32.000000 0 0.000000 + 64.000000 0 0.000000 + 128.000000 0 0.000000 + 256.000000 0 0.000000 + 512.000000 0 0.000000 + 1024.000000 0 0.000000 + 2048.000000 0 0.000000 + 4096.000000 0 0.000000 + 8192.000000 0 0.000000 + 16384.000000 0 0.000000 + 32768.000000 0 0.000000 + 65536.000000 0 0.000000 + 131072.000000 0 0.000000 + 262144.000000 0 0.000000 + 524288.000000 0 0.000000 +1048576.000000 0 0.000000 +2097152.000000 0 0.000000 +4194304.000000 0 0.000000 +8388608.000000 0 0.000000 +TOO LONG 0 TOO LONG +SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; +time count total + 0.000001 45 0.000000 + 0.000003 0 0.000000 + 0.000007 0 0.000000 + 0.000015 0 0.000000 + 0.000030 0 0.000000 + 0.000061 0 0.000000 + 0.000122 0 0.000000 + 0.000244 0 0.000000 + 0.000488 0 0.000000 + 0.000976 0 0.000000 + 0.001953 0 0.000000 + 0.003906 0 0.000000 + 0.007812 0 0.000000 + 0.015625 0 0.000000 + 0.031250 0 0.000000 + 0.062500 0 0.000000 + 0.125000 44 4.400000 + 0.250000 0 0.000000 + 0.500000 10 3.550000 + 1.000000 1 0.500000 + 2.000000 5 6.500000 + 4.000000 4 10.000000 + 8.000000 2 9.199999 + 16.000000 0 0.000000 + 32.000000 0 0.000000 + 64.000000 0 0.000000 + 128.000000 0 0.000000 + 256.000000 0 0.000000 + 512.000000 0 0.000000 + 1024.000000 0 0.000000 + 2048.000000 0 0.000000 + 4096.000000 0 0.000000 + 8192.000000 0 0.000000 + 16384.000000 0 0.000000 + 32768.000000 0 0.000000 + 65536.000000 0 0.000000 + 131072.000000 0 0.000000 + 262144.000000 0 0.000000 + 524288.000000 0 0.000000 +1048576.000000 0 0.000000 +2097152.000000 0 0.000000 +4194304.000000 0 0.000000 +8388608.000000 0 0.000000 +TOO LONG 0 TOO LONG +SET SESSION query_exec_time=default; +SET SESSION query_exec_time=0.1; +SET GLOBAL QUERY_RESPONSE_TIME_STATS=0; +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=10; +FLUSH QUERY_RESPONSE_TIME; +SET GLOBAL QUERY_RESPONSE_TIME_STATS=1; +CALL test_f(0.31); +CALL test_f(0.32); +CALL test_f(0.33); +CALL test_f(0.34); +CALL test_f(0.35); +CALL test_f(0.36); +CALL test_f(0.37); +CALL test_f(0.38); +CALL test_f(0.39); +CALL test_f(0.4); +CALL test_f(1.1); +CALL test_f(1.2); +CALL test_f(1.3); +CALL test_f(1.5); +CALL test_f(1.4); +CALL test_f(0.5); +CALL test_f(2.1); +CALL test_f(2.3); +CALL test_f(2.5); +CALL test_f(3.1); +CALL test_f(4.1); +CALL test_f(5.1); +SET GLOBAL QUERY_RESPONSE_TIME_STATS=0; +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; +Variable_name Value +query_response_time_range_base 10 +SHOW QUERY_RESPONSE_TIME; + + 0.000001 45 0.000000 + 0.000010 0 0.000000 + 0.000100 0 0.000000 + 0.001000 0 0.000000 + 0.010000 0 0.000000 + 0.100000 0 0.000000 + 1.000000 55 8.450000 + 10.000000 11 25.699999 + 100.000000 0 0.000000 + 1000.000000 0 0.000000 + 10000.000000 0 0.000000 + 100000.000000 0 0.000000 +1000000.000000 0 0.000000 +TOO LONG 0 TOO LONG +SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; +time count total + 0.000001 45 0.000000 + 0.000010 0 0.000000 + 0.000100 0 0.000000 + 0.001000 0 0.000000 + 0.010000 0 0.000000 + 0.100000 0 0.000000 + 1.000000 55 8.450000 + 10.000000 11 25.699999 + 100.000000 0 0.000000 + 1000.000000 0 0.000000 + 10000.000000 0 0.000000 + 100000.000000 0 0.000000 +1000000.000000 0 0.000000 +TOO LONG 0 TOO LONG +SET SESSION query_exec_time=default; +SET SESSION query_exec_time=0.1; +SET GLOBAL QUERY_RESPONSE_TIME_STATS=0; +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=7; +FLUSH QUERY_RESPONSE_TIME; +SET GLOBAL QUERY_RESPONSE_TIME_STATS=1; +CALL test_f(0.31); +CALL test_f(0.32); +CALL test_f(0.33); +CALL test_f(0.34); +CALL test_f(0.35); +CALL test_f(0.36); +CALL test_f(0.37); +CALL test_f(0.38); +CALL test_f(0.39); +CALL test_f(0.4); +CALL test_f(1.1); +CALL test_f(1.2); +CALL test_f(1.3); +CALL test_f(1.5); +CALL test_f(1.4); +CALL test_f(0.5); +CALL test_f(2.1); +CALL test_f(2.3); +CALL test_f(2.5); +CALL test_f(3.1); +CALL test_f(4.1); +CALL test_f(5.1); +SET GLOBAL QUERY_RESPONSE_TIME_STATS=0; +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; +Variable_name Value +query_response_time_range_base 7 +SHOW QUERY_RESPONSE_TIME; + + 0.000001 45 0.000000 + 0.000008 0 0.000000 + 0.000059 0 0.000000 + 0.000416 0 0.000000 + 0.002915 0 0.000000 + 0.020408 0 0.000000 + 0.142857 44 4.400000 + 1.000000 11 4.050000 + 7.000000 11 25.699999 + 49.000000 0 0.000000 + 343.000000 0 0.000000 + 2401.000000 0 0.000000 + 16807.000000 0 0.000000 + 117649.000000 0 0.000000 + 823543.000000 0 0.000000 +5764801.000000 0 0.000000 +TOO LONG 0 TOO LONG +SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; +time count total + 0.000001 45 0.000000 + 0.000008 0 0.000000 + 0.000059 0 0.000000 + 0.000416 0 0.000000 + 0.002915 0 0.000000 + 0.020408 0 0.000000 + 0.142857 44 4.400000 + 1.000000 11 4.050000 + 7.000000 11 25.699999 + 49.000000 0 0.000000 + 343.000000 0 0.000000 + 2401.000000 0 0.000000 + 16807.000000 0 0.000000 + 117649.000000 0 0.000000 + 823543.000000 0 0.000000 +5764801.000000 0 0.000000 +TOO LONG 0 TOO LONG +SET SESSION query_exec_time=default; +SET SESSION query_exec_time=0.1; +SET GLOBAL QUERY_RESPONSE_TIME_STATS=0; +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=156; +FLUSH QUERY_RESPONSE_TIME; +SET GLOBAL QUERY_RESPONSE_TIME_STATS=1; +CALL test_f(0.31); +CALL test_f(0.32); +CALL test_f(0.33); +CALL test_f(0.34); +CALL test_f(0.35); +CALL test_f(0.36); +CALL test_f(0.37); +CALL test_f(0.38); +CALL test_f(0.39); +CALL test_f(0.4); +CALL test_f(1.1); +CALL test_f(1.2); +CALL test_f(1.3); +CALL test_f(1.5); +CALL test_f(1.4); +CALL test_f(0.5); +CALL test_f(2.1); +CALL test_f(2.3); +CALL test_f(2.5); +CALL test_f(3.1); +CALL test_f(4.1); +CALL test_f(5.1); +SET GLOBAL QUERY_RESPONSE_TIME_STATS=0; +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; +Variable_name Value +query_response_time_range_base 156 +SHOW QUERY_RESPONSE_TIME; + + 0.000041 45 0.000000 + 0.006410 0 0.000000 + 1.000000 55 8.450000 + 156.000000 11 25.699999 + 24336.000000 0 0.000000 +3796416.000000 0 0.000000 +TOO LONG 0 TOO LONG +SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; +time count total + 0.000041 45 0.000000 + 0.006410 0 0.000000 + 1.000000 55 8.450000 + 156.000000 11 25.699999 + 24336.000000 0 0.000000 +3796416.000000 0 0.000000 +TOO LONG 0 TOO LONG +SET SESSION query_exec_time=default; +SET SESSION query_exec_time=0.1; +SET GLOBAL QUERY_RESPONSE_TIME_STATS=0; +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=1000; +FLUSH QUERY_RESPONSE_TIME; +SET GLOBAL QUERY_RESPONSE_TIME_STATS=1; +CALL test_f(0.31); +CALL test_f(0.32); +CALL test_f(0.33); +CALL test_f(0.34); +CALL test_f(0.35); +CALL test_f(0.36); +CALL test_f(0.37); +CALL test_f(0.38); +CALL test_f(0.39); +CALL test_f(0.4); +CALL test_f(1.1); +CALL test_f(1.2); +CALL test_f(1.3); +CALL test_f(1.5); +CALL test_f(1.4); +CALL test_f(0.5); +CALL test_f(2.1); +CALL test_f(2.3); +CALL test_f(2.5); +CALL test_f(3.1); +CALL test_f(4.1); +CALL test_f(5.1); +SET GLOBAL QUERY_RESPONSE_TIME_STATS=0; +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; +Variable_name Value +query_response_time_range_base 1000 +SHOW QUERY_RESPONSE_TIME; + + 0.000001 45 0.000000 + 0.001000 0 0.000000 + 1.000000 55 8.450000 + 1000.000000 11 25.699999 +1000000.000000 0 0.000000 +TOO LONG 0 TOO LONG +SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; +time count total + 0.000001 45 0.000000 + 0.001000 0 0.000000 + 1.000000 55 8.450000 + 1000.000000 11 25.699999 +1000000.000000 0 0.000000 +TOO LONG 0 TOO LONG +SET SESSION query_exec_time=default; +SET SESSION query_exec_time=0.1; +SET GLOBAL QUERY_RESPONSE_TIME_STATS=0; +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=1001; +Warnings: +Warning 1292 Truncated incorrect query_response_time_range_base value: '1001' +FLUSH QUERY_RESPONSE_TIME; +SET GLOBAL QUERY_RESPONSE_TIME_STATS=1; +CALL test_f(0.31); +CALL test_f(0.32); +CALL test_f(0.33); +CALL test_f(0.34); +CALL test_f(0.35); +CALL test_f(0.36); +CALL test_f(0.37); +CALL test_f(0.38); +CALL test_f(0.39); +CALL test_f(0.4); +CALL test_f(1.1); +CALL test_f(1.2); +CALL test_f(1.3); +CALL test_f(1.5); +CALL test_f(1.4); +CALL test_f(0.5); +CALL test_f(2.1); +CALL test_f(2.3); +CALL test_f(2.5); +CALL test_f(3.1); +CALL test_f(4.1); +CALL test_f(5.1); +SET GLOBAL QUERY_RESPONSE_TIME_STATS=0; +SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE'; +Variable_name Value +query_response_time_range_base 1000 +SHOW QUERY_RESPONSE_TIME; + + 0.000001 45 0.000000 + 0.001000 0 0.000000 + 1.000000 55 8.450000 + 1000.000000 11 25.699999 +1000000.000000 0 0.000000 +TOO LONG 0 TOO LONG +SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME; +time count total + 0.000001 45 0.000000 + 0.001000 0 0.000000 + 1.000000 55 8.450000 + 1000.000000 11 25.699999 +1000000.000000 0 0.000000 +TOO LONG 0 TOO LONG +SET SESSION query_exec_time=default; +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=default; +SET GLOBAL QUERY_RESPONSE_TIME_STATS=default; +DROP PROCEDURE test_f; +DROP TABLE t; --- /dev/null +++ b/mysql-test/t/percona_query_response_time-replication.test @@ -0,0 +1,28 @@ +SET GLOBAL query_exec_time=0.1; + +--source include/have_response_time_distribution.inc +--source include/have_debug.inc +--source include/have_binlog_format_statement.inc +--source include/master-slave.inc + +--let base=1 +--source include/query_response_time-replication.inc +--let base=2 +--source include/query_response_time-replication.inc +--let base=10 +--source include/query_response_time-replication.inc +--let base=7 +--source include/query_response_time-replication.inc +--let base=156 +--source include/query_response_time-replication.inc +--let base=1000 +--source include/query_response_time-replication.inc +--let base=1001 +--source include/query_response_time-replication.inc + +--source include/rpl_end.inc + +SET GLOBAL query_exec_time=default; + +connection slave; +SET GLOBAL query_exec_time=default; --- /dev/null +++ b/mysql-test/t/percona_query_response_time-stored.test @@ -0,0 +1,36 @@ +--source include/have_response_time_distribution.inc +--source include/have_debug.inc + +CREATE TABLE t(a INT); + +delimiter ^; +CREATE PROCEDURE test_f(t DECIMAL(3,2)) +BEGIN + SET SESSION query_exec_time=t; + INSERT INTO t VALUES(1); + SET SESSION query_exec_time=0.1; + DELETE FROM t; +END^ +delimiter ;^ + +--let base=1 +--source include/query_response_time-stored.inc +--let base=2 +--source include/query_response_time-stored.inc +--let base=10 +--source include/query_response_time-stored.inc +--let base=7 +--source include/query_response_time-stored.inc +--let base=156 +--source include/query_response_time-stored.inc +--let base=1000 +--source include/query_response_time-stored.inc +--let base=1001 +--source include/query_response_time-stored.inc + +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=default; +SET GLOBAL QUERY_RESPONSE_TIME_STATS=default; + +DROP PROCEDURE test_f; + +DROP TABLE t; --- /dev/null +++ b/mysql-test/t/percona_query_response_time.test @@ -0,0 +1,20 @@ +--source include/have_response_time_distribution.inc +--source include/have_debug.inc + +--let base=1 +--source include/query_response_time.inc +--let base=2 +--source include/query_response_time.inc +--let base=10 +--source include/query_response_time.inc +--let base=7 +--source include/query_response_time.inc +--let base=156 +--source include/query_response_time.inc +--let base=1000 +--source include/query_response_time.inc +--let base=1001 +--source include/query_response_time.inc + +SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=default; +SET GLOBAL QUERY_RESPONSE_TIME_STATS=default; --- /dev/null +++ b/patch_info/response-time-distribution.info @@ -0,0 +1,9 @@ +File=response-time-distribution.patch +Name=Response time distribution +Version=1.0 +Author=Percona +License=GPL +Comment= +Changelog +2010-07-02 first version avaliable +2010-09-15 add column 'total' --- a/sql/CMakeLists.txt +++ b/sql/CMakeLists.txt @@ -52,7 +52,7 @@ message.h mf_iocache.cc my_decimal.cc ../sql-common/my_time.c mysqld.cc net_serv.cc keycaches.cc ../sql-common/client_plugin.c - opt_range.cc opt_range.h opt_sum.cc + opt_range.cc opt_range.h query_response_time.h opt_sum.cc ../sql-common/pack.c parse_file.cc password.c procedure.cc protocol.cc records.cc repl_failsafe.cc rpl_filter.cc set_var.cc slave.cc sp.cc sp_cache.cc sp_head.cc sp_pcontext.cc @@ -60,7 +60,7 @@ sql_cache.cc sql_class.cc sql_client.cc sql_crypt.cc sql_crypt.h sql_cursor.cc sql_db.cc sql_delete.cc sql_derived.cc sql_do.cc sql_error.cc sql_handler.cc sql_help.cc sql_insert.cc sql_lex.cc - sql_list.cc sql_load.cc sql_manager.cc sql_parse.cc + sql_list.cc sql_load.cc sql_manager.cc sql_parse.cc query_response_time.cc sql_partition.cc sql_plugin.cc sql_prepare.cc sql_rename.cc debug_sync.cc debug_sync.h sql_repl.cc sql_select.cc sql_show.cc sql_state.c sql_string.cc --- a/sql/handler.h +++ b/sql/handler.h @@ -581,6 +581,7 @@ SCH_PROFILES, SCH_REFERENTIAL_CONSTRAINTS, SCH_PROCEDURES, + SCH_QUERY_RESPONSE_TIME, SCH_SCHEMATA, SCH_SCHEMA_PRIVILEGES, SCH_SESSION_STATUS, --- a/sql/lex.h +++ b/sql/lex.h @@ -426,6 +426,7 @@ { "PURGE", SYM(PURGE)}, { "QUARTER", SYM(QUARTER_SYM)}, { "QUERY", SYM(QUERY_SYM)}, + { "QUERY_RESPONSE_TIME", SYM(QUERY_RESPONSE_TIME_SYM)}, { "QUICK", SYM(QUICK)}, { "RANGE", SYM(RANGE_SYM)}, { "READ", SYM(READ_SYM)}, --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -69,6 +69,8 @@ #include "debug_sync.h" #include "sql_callback.h" +#include "query_response_time.h" + #ifdef WITH_PERFSCHEMA_STORAGE_ENGINE #include "../storage/perfschema/pfs_server.h" #endif /* WITH_PERFSCHEMA_STORAGE_ENGINE */ @@ -615,7 +617,7 @@ MY_LOCALE *my_default_lc_messages; MY_LOCALE *my_default_lc_time_names; -SHOW_COMP_OPTION have_ssl, have_symlink, have_dlopen, have_query_cache; +SHOW_COMP_OPTION have_ssl, have_symlink, have_dlopen, have_query_cache, have_response_time_distribution; SHOW_COMP_OPTION have_geometry, have_rtree_keys; SHOW_COMP_OPTION have_crypt, have_compress; SHOW_COMP_OPTION have_profiling; @@ -917,6 +919,10 @@ my_bool opt_enable_shared_memory; HANDLE smem_event_connect_request= 0; #endif +#ifdef HAVE_RESPONSE_TIME_DISTRIBUTION +ulong opt_query_response_time_range_base = QRT_DEFAULT_BASE; +my_bool opt_query_response_time_stats= 0; +#endif // HAVE_RESPONSE_TIME_DISTRIBUTION my_bool opt_use_ssl = 0; char *opt_ssl_ca= NULL, *opt_ssl_capath= NULL, *opt_ssl_cert= NULL, @@ -1488,6 +1494,9 @@ my_free(opt_bin_logname); bitmap_free(&temp_pool); free_max_user_conn(); +#ifdef HAVE_RESPONSE_TIME_DISTRIBUTION + query_response_time_free(); +#endif // HAVE_RESPONSE_TIME_DISTRIBUTION #ifdef HAVE_REPLICATION end_slave_list(); #endif @@ -3860,6 +3869,9 @@ if (!DEFAULT_ERRMSGS[0][0]) unireg_abort(1); +#ifdef HAVE_RESPONSE_TIME_DISTRIBUTION + query_response_time_init(); +#endif // HAVE_RESPONSE_TIME_DISTRIBUTION /* We have to initialize the storage engines before CSV logging */ if (ha_init()) { @@ -6773,6 +6785,11 @@ #else have_query_cache=SHOW_OPTION_NO; #endif +#ifdef HAVE_RESPONSE_TIME_DISTRIBUTION + have_response_time_distribution= SHOW_OPTION_YES; +#else // HAVE_RESPONSE_TIME_DISTRIBUTION + have_response_time_distribution= SHOW_OPTION_NO; +#endif // HAVE_RESPONSE_TIME_DISTRIBUTION #ifdef HAVE_SPATIAL have_geometry=SHOW_OPTION_YES; #else --- a/sql/mysqld.h +++ b/sql/mysqld.h @@ -98,6 +98,10 @@ extern bool opt_disable_networking, opt_skip_show_db; extern bool opt_skip_name_resolve; extern bool opt_ignore_builtin_innodb; +#ifdef HAVE_RESPONSE_TIME_DISTRIBUTION +extern ulong opt_query_response_time_range_base; +extern my_bool opt_query_response_time_stats; +#endif // HAVE_RESPONSE_TIME_DISTRIBUTION extern my_bool opt_character_set_client_handshake; extern bool volatile abort_loop; extern bool in_bootstrap; --- /dev/null +++ b/sql/query_response_time.cc @@ -0,0 +1,302 @@ +#include "mysql_version.h" +#include "my_global.h" +#ifdef HAVE_RESPONSE_TIME_DISTRIBUTION +#include "mysql_com.h" +#include "rpl_tblmap.h" +#include "table.h" +#include "field.h" +#include "sql_show.h" +#include "query_response_time.h" + +#define TIME_STRING_POSITIVE_POWER_LENGTH QRT_TIME_STRING_POSITIVE_POWER_LENGTH +#define TIME_STRING_NEGATIVE_POWER_LENGTH 6 +#define TOTAL_STRING_POSITIVE_POWER_LENGTH QRT_TOTAL_STRING_POSITIVE_POWER_LENGTH +#define TOTAL_STRING_NEGATIVE_POWER_LENGTH 6 +#define MINIMUM_BASE 2 +#define MAXIMUM_BASE QRT_MAXIMUM_BASE +#define POSITIVE_POWER_FILLER QRT_POSITIVE_POWER_FILLER +#define NEGATIVE_POWER_FILLER QRT_NEGATIVE_POWER_FILLER +#define TIME_OVERFLOW QRT_TIME_OVERFLOW +#define DEFAULT_BASE QRT_DEFAULT_BASE + +#define do_xstr(s) do_str(s) +#define do_str(s) #s +#define do_format(filler,width) "%" filler width "lld" +/* + Format strings for snprintf. Generate from: + POSITIVE_POWER_FILLER and TIME_STRING_POSITIVE_POWER_LENGTH + NEFATIVE_POWER_FILLER and TIME_STRING_NEGATIVE_POWER_LENGTH +*/ +#define TIME_STRING_POSITIVE_POWER_FORMAT do_format(POSITIVE_POWER_FILLER,do_xstr(TIME_STRING_POSITIVE_POWER_LENGTH)) +#define TIME_STRING_NEGATIVE_POWER_FORMAT do_format(NEGATIVE_POWER_FILLER,do_xstr(TIME_STRING_NEGATIVE_POWER_LENGTH)) +#define TIME_STRING_FORMAT TIME_STRING_POSITIVE_POWER_FORMAT "." TIME_STRING_NEGATIVE_POWER_FORMAT + +#define TOTAL_STRING_POSITIVE_POWER_FORMAT do_format(POSITIVE_POWER_FILLER,do_xstr(TOTAL_STRING_POSITIVE_POWER_LENGTH)) +#define TOTAL_STRING_NEGATIVE_POWER_FORMAT do_format(NEGATIVE_POWER_FILLER,do_xstr(TOTAL_STRING_NEGATIVE_POWER_LENGTH)) +#define TOTAL_STRING_FORMAT TOTAL_STRING_POSITIVE_POWER_FORMAT "." TOTAL_STRING_NEGATIVE_POWER_FORMAT + +#define TIME_STRING_LENGTH QRT_TIME_STRING_LENGTH +#define TIME_STRING_BUFFER_LENGTH (TIME_STRING_LENGTH + 1 /* '\0' */) + +#define TOTAL_STRING_LENGTH QRT_TOTAL_STRING_LENGTH +#define TOTAL_STRING_BUFFER_LENGTH (TOTAL_STRING_LENGTH + 1 /* '\0' */) + +/* + Calculate length of "log linear" + 1) + (MINIMUM_BASE ^ result) <= (10 ^ STRING_POWER_LENGTH) < (MINIMUM_BASE ^ (result + 1)) + + 2) + (MINIMUM_BASE ^ result) <= (10 ^ STRING_POWER_LENGTH) + and + (MINIMUM_BASE ^ (result + 1)) > (10 ^ STRING_POWER_LENGTH) + + 3) + result <= LOG(MINIMUM_BASE, 10 ^ STRING_POWER_LENGTH)= STRING_POWER_LENGTH * LOG(MINIMUM_BASE,10) + result + 1 > LOG(MINIMUM_BASE, 10 ^ STRING_POWER_LENGTH)= STRING_POWER_LENGTH * LOG(MINIMUM_BASE,10) + + 4) STRING_POWER_LENGTH * LOG(MINIMUM_BASE,10) - 1 < result <= STRING_POWER_LENGTH * LOG(MINIMUM_BASE,10) + + MINIMUM_BASE= 2 always, LOG(MINIMUM_BASE,10)= 3.3219280948873626, result= (int)3.3219280948873626 * STRING_POWER_LENGTH + + Last counter always use for time overflow +*/ +#define POSITIVE_POWER_COUNT ((int)(3.32192809 * TIME_STRING_POSITIVE_POWER_LENGTH)) +#define NEGATIVE_POWER_COUNT ((int)(3.32192809 * TIME_STRING_NEGATIVE_POWER_LENGTH)) +#define OVERALL_POWER_COUNT (NEGATIVE_POWER_COUNT + 1 + POSITIVE_POWER_COUNT) + +#define MILLION ((unsigned long)1000 * 1000) + +namespace query_response_time +{ + +class utility +{ +public: + utility() : m_base(0) + { + m_max_dec_value= MILLION; + for(int i= 0; TIME_STRING_POSITIVE_POWER_LENGTH > i; ++i) + m_max_dec_value *= 10; + setup(DEFAULT_BASE); + } +public: + uint base() const { return m_base; } + uint negative_count() const { return m_negative_count; } + uint positive_count() const { return m_positive_count; } + uint bound_count() const { return m_bound_count; } + ulonglong max_dec_value() const { return m_max_dec_value; } + ulonglong bound(uint index) const { return m_bound[ index ]; } +public: + void setup(uint base) + { + if(base != m_base) + { + m_base= base; + + const ulonglong million= 1000 * 1000; + ulonglong value= million; + m_negative_count= 0; + while(value > 0) + { + m_negative_count += 1; + value /= m_base; + } + m_negative_count -= 1; + + value= million; + m_positive_count= 0; + while(value < m_max_dec_value) + { + m_positive_count += 1; + value *= m_base; + } + m_bound_count= m_negative_count + m_positive_count; + + value= million; + for(uint i= 0; i < m_negative_count; ++i) + { + value /= m_base; + m_bound[m_negative_count - i - 1]= value; + } + value= million; + for(uint i= 0; i < m_positive_count; ++i) + { + m_bound[m_negative_count + i]= value; + value *= m_base; + } + } + } +private: + uint m_base; + uint m_negative_count; + uint m_positive_count; + uint m_bound_count; + ulonglong m_max_dec_value; /* for TIME_STRING_POSITIVE_POWER_LENGTH=7 is 10000000 */ + ulonglong m_bound[OVERALL_POWER_COUNT]; +}; + +static +void print_time(char* buffer, std::size_t buffer_size, const char* format, + uint64 value) +{ + ulonglong second= (value / MILLION); + ulonglong microsecond= (value % MILLION); + my_snprintf(buffer, buffer_size, format, second, microsecond); +} + +class time_collector +{ +public: + time_collector(utility& u) : m_utility(&u) + { + my_atomic_rwlock_init(&time_collector_lock); + } + ~time_collector() + { + my_atomic_rwlock_destroy(&time_collector_lock); + } + uint32 count(uint index) const + { + my_atomic_rwlock_rdlock(&time_collector_lock); + uint32 result= my_atomic_load32((int32*)&m_count[index]); + my_atomic_rwlock_rdunlock(&time_collector_lock); + return result; + } + uint64 total(uint index) const + { + my_atomic_rwlock_rdlock(&time_collector_lock); + uint64 result= my_atomic_load64((int64*)&m_total[index]); + my_atomic_rwlock_rdunlock(&time_collector_lock); + return result; + } +public: + void flush() + { + my_atomic_rwlock_wrlock(&time_collector_lock); + memset((void*)&m_count,0,sizeof(m_count)); + memset((void*)&m_total,0,sizeof(m_total)); + my_atomic_rwlock_wrunlock(&time_collector_lock); + } + void collect(uint64 time) + { + int i= 0; + for(int count= m_utility->bound_count(); count > i; ++i) + { + if(m_utility->bound(i) > time) + { + my_atomic_rwlock_wrlock(&time_collector_lock); + my_atomic_add32((int32*)(&m_count[i]), 1); + my_atomic_add64((int64*)(&m_total[i]), time); + my_atomic_rwlock_wrunlock(&time_collector_lock); + break; + } + } + } +private: + utility* m_utility; + /* The lock for atomic operations on m_count and m_total. Only actually + used on architectures that do not have atomic implementation of atomic + operations. */ + my_atomic_rwlock_t time_collector_lock; + uint32 m_count[OVERALL_POWER_COUNT + 1]; + uint64 m_total[OVERALL_POWER_COUNT + 1]; +}; + +class collector +{ +public: + collector() : m_time(m_utility) + { + m_utility.setup(DEFAULT_BASE); + m_time.flush(); + } +public: + void flush() + { + m_utility.setup(opt_query_response_time_range_base); + m_time.flush(); + } + int fill(THD* thd, TABLE_LIST *tables, COND *cond) + { + DBUG_ENTER("fill_schema_query_response_time"); + TABLE *table= static_cast(tables->table); + Field **fields= table->field; + for(uint i= 0, count= bound_count() + 1 /* with overflow */; count > i; ++i) + { + char time[TIME_STRING_BUFFER_LENGTH]; + char total[TOTAL_STRING_BUFFER_LENGTH]; + if(i == bound_count()) + { + assert(sizeof(TIME_OVERFLOW) <= TIME_STRING_BUFFER_LENGTH); + assert(sizeof(TIME_OVERFLOW) <= TOTAL_STRING_BUFFER_LENGTH); + memcpy(time,TIME_OVERFLOW,sizeof(TIME_OVERFLOW)); + memcpy(total,TIME_OVERFLOW,sizeof(TIME_OVERFLOW)); + } + else + { + print_time(time, sizeof(time), TIME_STRING_FORMAT, this->bound(i)); + print_time(total, sizeof(total), TOTAL_STRING_FORMAT, this->total(i)); + } + fields[0]->store(time,strlen(time),system_charset_info); + fields[1]->store(this->count(i)); + fields[2]->store(total,strlen(total),system_charset_info); + if (schema_table_store_record(thd, table)) + { + DBUG_RETURN(1); + } + } + DBUG_RETURN(0); + } + void collect(ulonglong time) + { + m_time.collect(time); + } + uint bound_count() const + { + return m_utility.bound_count(); + } + ulonglong bound(uint index) + { + return m_utility.bound(index); + } + ulonglong count(uint index) + { + return m_time.count(index); + } + ulonglong total(uint index) + { + return m_time.total(index); + } +private: + utility m_utility; + time_collector m_time; +}; + +static collector g_collector; + +} // namespace query_response_time + +void query_response_time_init() +{ +} + +void query_response_time_free() +{ + query_response_time::g_collector.flush(); +} + +void query_response_time_flush() +{ + query_response_time::g_collector.flush(); +} +void query_response_time_collect(ulonglong query_time) +{ + query_response_time::g_collector.collect(query_time); +} + +int query_response_time_fill(THD* thd, TABLE_LIST *tables, COND *cond) +{ + return query_response_time::g_collector.fill(thd,tables,cond); +} +#endif // HAVE_RESPONSE_TIME_DISTRIBUTION --- /dev/null +++ b/sql/query_response_time.h @@ -0,0 +1,64 @@ +#ifndef QUERY_RESPONSE_TIME_H +#define QUERY_RESPONSE_TIME_H + +/* + Settings for query response time +*/ + +/* + Maximum string length for (10 ^ (-1 * QRT_STRING_NEGATIVE_POWER_LENGTH)) in text representation. + Example: for 6 is 0.000001 + Always 2 + + Maximum string length for (10 ^ (QRT_STRING_POSITIVE_POWER_LENGTH + 1) - 1) in text representation. + Example: for 7 is 9999999.0 +*/ +#define QRT_TIME_STRING_POSITIVE_POWER_LENGTH 7 +#define QRT_TOTAL_STRING_POSITIVE_POWER_LENGTH 7 + +/* + Minimum base for log - ALWAYS 2 + Maximum base for log: +*/ +#define QRT_MAXIMUM_BASE 1000 + +/* + Filler for whole number (positive power) + Example: for + QRT_POSITIVE_POWER_FILLER ' ' + QRT_POSITIVE_POWER_LENGTH 7 + and number 7234 result is: + ' 7234' +*/ +#define QRT_POSITIVE_POWER_FILLER "" +/* + Filler for fractional number. Similiary to whole number +*/ +#define QRT_NEGATIVE_POWER_FILLER "0" + +/* + Message if time too big for statistic collecting (very long query) +*/ +#define QRT_TIME_OVERFLOW "TOO LONG" + +#define QRT_DEFAULT_BASE 10 + +#define QRT_TIME_STRING_LENGTH \ + max( (QRT_TIME_STRING_POSITIVE_POWER_LENGTH + 1 /* '.' */ + 6 /*QRT_TIME_STRING_NEGATIVE_POWER_LENGTH*/), \ + (sizeof(QRT_TIME_OVERFLOW) - 1) ) + +#define QRT_TOTAL_STRING_LENGTH \ + max( (QRT_TOTAL_STRING_POSITIVE_POWER_LENGTH + 1 /* '.' */ + 6 /*QRT_TOTAL_STRING_NEGATIVE_POWER_LENGTH*/), \ + (sizeof(QRT_TIME_OVERFLOW) - 1) ) + +extern ST_SCHEMA_TABLE query_response_time_table; + +#ifdef HAVE_RESPONSE_TIME_DISTRIBUTION +extern void query_response_time_init (); +extern void query_response_time_free (); +extern void query_response_time_flush (); +extern void query_response_time_collect(ulonglong query_time); +extern int query_response_time_fill (THD* thd, TABLE_LIST *tables, COND *cond); +#endif // HAVE_RESPONSE_TIME_DISTRIBUTION + +#endif // QUERY_RESPONSE_TIME_H --- a/sql/set_var.h +++ b/sql/set_var.h @@ -294,6 +294,7 @@ extern SHOW_COMP_OPTION have_ssl, have_symlink, have_dlopen; extern SHOW_COMP_OPTION have_query_cache; +extern SHOW_COMP_OPTION have_response_time_distribution; extern SHOW_COMP_OPTION have_geometry, have_rtree_keys; extern SHOW_COMP_OPTION have_crypt; extern SHOW_COMP_OPTION have_compress; --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -88,6 +88,7 @@ #include "sp_cache.h" #include "events.h" #include "sql_trigger.h" +#include "query_response_time.h" #include "transaction.h" #include "sql_audit.h" #include "sql_prepare.h" @@ -1518,6 +1519,12 @@ ulonglong end_utime_of_query= thd->current_utime(); ulonglong query_exec_time= get_query_exec_time(thd, end_utime_of_query); +#ifdef HAVE_RESPONSE_TIME_DISTRIBUTION + if (opt_query_response_time_stats) + { + query_response_time_collect(query_exec_time); + } +#endif /* Low long_query_time value most likely means user is debugging stuff and even @@ -1682,6 +1689,7 @@ case SCH_CHARSETS: case SCH_ENGINES: case SCH_COLLATIONS: + case SCH_QUERY_RESPONSE_TIME: case SCH_COLLATION_CHARACTER_SET_APPLICABILITY: case SCH_USER_PRIVILEGES: case SCH_SCHEMA_PRIVILEGES: --- a/sql/sql_reload.cc +++ b/sql/sql_reload.cc @@ -25,7 +25,7 @@ #include "hostname.h" // hostname_cache_refresh #include "sql_repl.h" // reset_master, reset_slave #include "debug_sync.h" - +#include "query_response_time.h" /** Reload/resets privileges and the different caches. @@ -322,6 +322,12 @@ #endif if (options & REFRESH_USER_RESOURCES) reset_mqh((LEX_USER *) NULL, 0); /* purecov: inspected */ +#ifdef HAVE_RESPONSE_TIME_DISTRIBUTION + if (options & REFRESH_QUERY_RESPONSE_TIME) + { + query_response_time_flush(); + } +#endif // HAVE_RESPONSE_TIME_DISTRIBUTION if (*write_to_binlog != -1) *write_to_binlog= tmp_write_to_binlog; /* --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -50,6 +50,7 @@ #include "event_data_objects.h" #endif #include +#include "query_response_time.h" #include "lock.h" // MYSQL_OPEN_IGNORE_FLUSH #include "debug_sync.h" #include "datadict.h" // dd_frm_type() @@ -7888,6 +7889,14 @@ */ +ST_FIELD_INFO query_response_time_fields_info[] = + { + {"time", QRT_TIME_STRING_LENGTH, MYSQL_TYPE_STRING, 0, 0, "", SKIP_OPEN_TABLE }, + {"count", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, MY_I_S_UNSIGNED, "", SKIP_OPEN_TABLE }, + {"total", QRT_TIME_STRING_LENGTH, MYSQL_TYPE_STRING, 0, 0, "", SKIP_OPEN_TABLE }, + {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE } + }; + ST_SCHEMA_TABLE schema_tables[]= { {"CHARACTER_SETS", charsets_fields_info, create_schema_table, @@ -7941,6 +7950,13 @@ 1, 9, 0, OPTIMIZE_I_S_TABLE|OPEN_TABLE_ONLY}, {"ROUTINES", proc_fields_info, create_schema_table, fill_schema_proc, make_proc_old_format, 0, -1, -1, 0, 0}, +#ifdef HAVE_RESPONSE_TIME_DISTRIBUTION + {"QUERY_RESPONSE_TIME", query_response_time_fields_info, create_schema_table, + query_response_time_fill, make_old_format, 0, -1, -1, 0, 0}, +#else + {"QUERY_RESPONSE_TIME", query_response_time_fields_info, create_schema_table, + 0, make_old_format, 0, -1, -1, 0, 0}, +#endif // HAVE_RESPONSE_TIME_DISTRIBUTION {"SCHEMATA", schema_fields_info, create_schema_table, fill_schema_schemata, make_schemata_old_format, 0, 1, -1, 0, 0}, {"SCHEMA_PRIVILEGES", schema_privileges_fields_info, create_schema_table, --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -1194,6 +1194,7 @@ %token PURGE %token QUARTER_SYM %token QUERY_SYM +%token QUERY_RESPONSE_TIME_SYM %token QUICK %token RANGE_SYM /* SQL-2003-R */ %token READS_SYM /* SQL-2003-R */ @@ -11105,6 +11106,15 @@ { Lex->sql_command = SQLCOM_SHOW_SLAVE_STAT; } + | QUERY_RESPONSE_TIME_SYM wild_and_where + { +#ifdef HAVE_RESPONSE_TIME_DISTRIBUTION + LEX *lex= Lex; + lex->sql_command= SQLCOM_SELECT; + if (prepare_schema_table(YYTHD, lex, 0, SCH_QUERY_RESPONSE_TIME)) + MYSQL_YYABORT; +#endif // HAVE_RESPONSE_TIME_DISTRIBUTION + } | CREATE PROCEDURE_SYM sp_name { LEX *lex= Lex; @@ -11344,6 +11354,12 @@ Lex->type|= REFRESH_SLAVE; Lex->reset_slave_info.all= false; } + | QUERY_RESPONSE_TIME_SYM + { +#ifdef HAVE_RESPONSE_TIME_DISTRIBUTION + Lex->type|= REFRESH_QUERY_RESPONSE_TIME; +#endif // HAVE_RESPONSE_TIME_DISTRIBUTION + } | MASTER_SYM { Lex->type|= REFRESH_MASTER; } | DES_KEY_FILE @@ -12651,6 +12667,7 @@ | PROXY_SYM {} | QUARTER_SYM {} | QUERY_SYM {} + | QUERY_RESPONSE_TIME_SYM {} | QUICK {} | READ_ONLY_SYM {} | REBUILD_SYM {} --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -51,6 +51,7 @@ TYPELIB bool_typelib={ array_elements(bool_values)-1, "", bool_values, 0 }; +#include "query_response_time.h" /* This forward declaration is needed because including sql_base.h causes further includes. [TODO] Eliminate this forward declaration @@ -1939,6 +1940,26 @@ DEFAULT(FALSE)); #endif /* HAVE_QUERY_CACHE */ + +static Sys_var_have Sys_have_response_time_distribution( + "have_response_time_distribution", "have_response_time_distribution", + READ_ONLY GLOBAL_VAR(have_response_time_distribution), NO_CMD_LINE); + +#ifdef HAVE_RESPONSE_TIME_DISTRIBUTION +static Sys_var_mybool Sys_query_response_time_stats( + "query_response_time_stats", "Enable or disable query response time statisics collecting", + GLOBAL_VAR(opt_query_response_time_stats), CMD_LINE(OPT_ARG), + DEFAULT(FALSE)); + +static Sys_var_ulong Sys_query_response_time_range_base( + "query_response_time_range_base", + "Select base of log for query_response_time ranges. WARNING: variable change affect only after flush", + GLOBAL_VAR(opt_query_response_time_range_base), + CMD_LINE(REQUIRED_ARG), VALID_RANGE(2, QRT_MAXIMUM_BASE), + DEFAULT(QRT_DEFAULT_BASE), + BLOCK_SIZE(1)); +#endif // HAVE_RESPONSE_TIME_DISTRIBUTION + static Sys_var_mybool Sys_secure_auth( "secure_auth", "Disallow authentication for accounts that have old (pre-4.1) " --- /dev/null +++ b/mysql-test/r/have_response_time_distribution.require @@ -0,0 +1,2 @@ +Variable_name Value +have_response_time_distribution YES --- a/include/atomic/x86-gcc.h +++ b/include/atomic/x86-gcc.h @@ -108,27 +108,23 @@ v=tmp; /* - On some platforms (e.g. Mac OS X and Solaris) the ebx register - is held as a pointer to the global offset table. Thus we're not - allowed to use the b-register on those platforms when compiling - PIC code, to avoid this we push ebx and pop ebx. The new value - is copied directly from memory to avoid problems with a implicit - manipulation of the stack pointer by the push. - cmpxchg8b works on both 32-bit platforms and 64-bit platforms but the code here is only used on 32-bit platforms, on 64-bit platforms the much simpler make_atomic_cas_body32 will work fine. */ -#define make_atomic_cas_body64 \ - asm volatile ("push %%ebx;" \ - "movl (%%ecx), %%ebx;" \ - "movl 4(%%ecx), %%ecx;" \ - LOCK_prefix "; cmpxchg8b %0;" \ - "setz %2; pop %%ebx" \ - : "=m" (*a), "+A" (*cmp), "=c" (ret) \ - : "c" (&set), "m" (*a) \ - : "memory", "esp") +#define make_atomic_cas_body64 \ + asm volatile ("movl %%edi, -4(%%esp);" \ + "leal %0, %%edi;" \ + "xchgl %%ebx, %%esi;" \ + LOCK_prefix "; cmpxchg8b (%%edi);" \ + "movl %%esi, %%ebx;" \ + "movl -4(%%esp), %%edi;" \ + "setz %1;" \ + : "+m" (*a), "=q" (ret), "+A" (*cmp) \ + : "S" ((int32)(set & 0xFFFFFFFF)), \ + "c" ((int32)(set >> 32)) \ + : "memory", "flags") #endif /* --- a/mysql-test/r/mysqld--help-notwin.result +++ b/mysql-test/r/mysqld--help-notwin.result @@ -505,6 +505,12 @@ Invalidate queries in query cache on LOCK for write --query-prealloc-size=# Persistent buffer for query parsing and execution + --query-response-time-range-base=# + Select base of log for query_response_time ranges. + WARNING: variable change affect only after flush + --query-response-time-stats + Enable or disable query response time statisics + collecting --range-alloc-block-size=# Allocation block size for storing ranges during optimization @@ -939,6 +945,8 @@ query-cache-type ON query-cache-wlock-invalidate FALSE query-prealloc-size 8192 +query-response-time-range-base 10 +query-response-time-stats FALSE range-alloc-block-size 4096 read-buffer-size 131072 read-only FALSE