SET SESSION debug="+d,response_time_distribution_log_only_more_300_milliseconds";
CREATE FUNCTION test_f()
RETURNS CHAR(30) DETERMINISTIC
BEGIN
DECLARE first  VARCHAR(5);
DECLARE second VARCHAR(5);
DECLARE result VARCHAR(20);
SELECT SLEEP(1.11) INTO first;
SET first= 'Hello';
SET second=', ';
SET result= CONCAT(first,second);
SET result= CONCAT(result,'world!');
RETURN result;
END/
SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 1;
Warnings:
Warning	1292	Truncated incorrect query_response_time_range_base value: '1'
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
Variable_name	Value
query_response_time_range_base	2
SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 2;
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
Variable_name	Value
query_response_time_range_base	2
FLUSH QUERY_RESPONSE_TIME;
SELECT d.count,
(SELECT SUM(a.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as a WHERE a.count != 0) as query_count,
(SELECT SUM((b.total * 1000000) DIV 1000000) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as b WHERE b.count != 0) as query_total,
(SELECT COUNT(*)     FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as c WHERE c.count != 0) as not_zero_region_count,
(SELECT COUNT(*)     FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME) as region_count
FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as d WHERE d.count > 0;
count	query_count	query_total	not_zero_region_count	region_count
SELECT COUNT(*) as region_count FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
region_count
44
SELECT time FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
time
      0.000001
      0.000003
      0.000007
      0.000015
      0.000030
      0.000061
      0.000122
      0.000244
      0.000488
      0.000976
      0.001953
      0.003906
      0.007812
      0.015625
      0.031250
      0.062500
      0.125000
      0.250000
      0.500000
      1.000000
      2.000000
      4.000000
      8.000000
     16.000000
     32.000000
     64.000000
    128.000000
    256.000000
    512.000000
   1024.000000
   2048.000000
   4096.000000
   8192.000000
  16384.000000
  32768.000000
  65536.000000
 131072.000000
 262144.000000
 524288.000000
 1048576.00000
 2097152.00000
 4194304.00000
 8388608.00000
TOO LONG
SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
SELECT test_f();
test_f()
Hello, world!
SELECT test_f();
test_f()
Hello, world!
SELECT test_f();
test_f()
Hello, world!
SELECT test_f();
test_f()
Hello, world!
SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
SELECT d.count,
(SELECT SUM(a.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as a WHERE a.count != 0) as query_count,
(SELECT SUM((b.total * 1000000) DIV 1000000) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as b WHERE b.count != 0) as query_total,
(SELECT COUNT(*)     FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as c WHERE c.count != 0) as not_zero_region_count,
(SELECT COUNT(*)     FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME) as region_count
FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as d WHERE d.count > 0;
count	query_count	query_total	not_zero_region_count	region_count
4	4	4	1	44
SELECT COUNT(*) as region_count FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
region_count
44
SELECT time FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
time
      0.000001
      0.000003
      0.000007
      0.000015
      0.000030
      0.000061
      0.000122
      0.000244
      0.000488
      0.000976
      0.001953
      0.003906
      0.007812
      0.015625
      0.031250
      0.062500
      0.125000
      0.250000
      0.500000
      1.000000
      2.000000
      4.000000
      8.000000
     16.000000
     32.000000
     64.000000
    128.000000
    256.000000
    512.000000
   1024.000000
   2048.000000
   4096.000000
   8192.000000
  16384.000000
  32768.000000
  65536.000000
 131072.000000
 262144.000000
 524288.000000
 1048576.00000
 2097152.00000
 4194304.00000
 8388608.00000
TOO LONG
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
Variable_name	Value
query_response_time_range_base	2
SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 10;
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
Variable_name	Value
query_response_time_range_base	10
FLUSH QUERY_RESPONSE_TIME;
SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
SELECT test_f();
test_f()
Hello, world!
SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
SELECT d.count,
(SELECT SUM(a.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as a WHERE a.count != 0) as query_count,
(SELECT SUM((b.total * 1000000) DIV 1000000) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as b WHERE b.count != 0) as query_total,
(SELECT COUNT(*)     FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as c WHERE c.count != 0) as not_zero_region_count,
(SELECT COUNT(*)     FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME) as region_count
FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as d WHERE d.count > 0;
count	query_count	query_total	not_zero_region_count	region_count
1	1	1	1	14
SELECT COUNT(*) as region_count FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
region_count
14
SELECT time FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
time
      0.000001
      0.000010
      0.000100
      0.001000
      0.010000
      0.100000
      1.000000
     10.000000
    100.000000
   1000.000000
  10000.000000
 100000.000000
 1000000.00000
TOO LONG
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
Variable_name	Value
query_response_time_range_base	10
SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 7;
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
Variable_name	Value
query_response_time_range_base	7
FLUSH QUERY_RESPONSE_TIME;
SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
SELECT test_f();
test_f()
Hello, world!
SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
SELECT d.count,
(SELECT SUM(a.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as a WHERE a.count != 0) as query_count,
(SELECT SUM((b.total * 1000000) DIV 1000000) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as b WHERE b.count != 0) as query_total,
(SELECT COUNT(*)     FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as c WHERE c.count != 0) as not_zero_region_count,
(SELECT COUNT(*)     FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME) as region_count
FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as d WHERE d.count > 0;
count	query_count	query_total	not_zero_region_count	region_count
1	1	1	1	17
SELECT COUNT(*) as region_count FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
region_count
17
SELECT time FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
time
      0.000001
      0.000008
      0.000059
      0.000416
      0.002915
      0.020408
      0.142857
      1.000000
      7.000000
     49.000000
    343.000000
   2401.000000
  16807.000000
 117649.000000
 823543.000000
 5764801.00000
TOO LONG
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
Variable_name	Value
query_response_time_range_base	7
SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 156;
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
Variable_name	Value
query_response_time_range_base	156
FLUSH QUERY_RESPONSE_TIME;
SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
SELECT test_f();
test_f()
Hello, world!
SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
SELECT d.count,
(SELECT SUM(a.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as a WHERE a.count != 0) as query_count,
(SELECT SUM((b.total * 1000000) DIV 1000000) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as b WHERE b.count != 0) as query_total,
(SELECT COUNT(*)     FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as c WHERE c.count != 0) as not_zero_region_count,
(SELECT COUNT(*)     FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME) as region_count
FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as d WHERE d.count > 0;
count	query_count	query_total	not_zero_region_count	region_count
1	1	1	1	7
SELECT COUNT(*) as region_count FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
region_count
7
SELECT time FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
time
      0.000041
      0.006410
      1.000000
    156.000000
  24336.000000
 3796416.00000
TOO LONG
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
Variable_name	Value
query_response_time_range_base	156
SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 1000;
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
Variable_name	Value
query_response_time_range_base	1000
FLUSH QUERY_RESPONSE_TIME;
SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=1;
SELECT test_f();
test_f()
Hello, world!
SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
SELECT d.count,
(SELECT SUM(a.count) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as a WHERE a.count != 0) as query_count,
(SELECT SUM((b.total * 1000000) DIV 1000000) FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as b WHERE b.count != 0) as query_total,
(SELECT COUNT(*)     FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as c WHERE c.count != 0) as not_zero_region_count,
(SELECT COUNT(*)     FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME) as region_count
FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME as d WHERE d.count > 0;
count	query_count	query_total	not_zero_region_count	region_count
1	1	1	1	6
SELECT COUNT(*) as region_count FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
region_count
6
SELECT time FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
time
      0.000001
      0.001000
      1.000000
   1000.000000
 1000000.00000
TOO LONG
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
Variable_name	Value
query_response_time_range_base	1000
SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE = 1001;
Warnings:
Warning	1292	Truncated incorrect query_response_time_range_base value: '1001'
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
Variable_name	Value
query_response_time_range_base	1000
SET GLOBAL ENABLE_QUERY_RESPONSE_TIME_STATS=0;
SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE  =10;
DROP FUNCTION test_f;
SET SESSION debug="-d,response_time_distribution_log_only_more_300_milliseconds";
