]> git.pld-linux.org Git - packages/mysql.git/blame - response_time_distribution.patch
- rel 2; patches updated
[packages/mysql.git] / response_time_distribution.patch
CommitLineData
b4e1fa2c
AM
1# name : response-time-distribution.patch
2# introduced : 12
3# maintainer : Oleg
4#
5#!!! notice !!!
6# Any small change to this file in the main branch
7# should be done or reviewed by the maintainer!
db82db79
AM
8--- a/CMakeLists.txt
9+++ b/CMakeLists.txt
d8778560 10@@ -165,7 +165,12 @@
b4e1fa2c
AM
11 OPTION (WITH_UNIT_TESTS "Compile MySQL with unit tests" ON)
12 MARK_AS_ADVANCED(CYBOZU BACKUP_TEST WITHOUT_SERVER DISABLE_SHARED)
13
14-
15+OPTION(WITHOUT_RESPONSE_TIME_DISTRIBUTION "If we want to have response_time_distribution" OFF)
16+IF(WITHOUT_RESPONSE_TIME_DISTRIBUTION)
17+ELSE()
18+ADD_DEFINITIONS(-DHAVE_RESPONSE_TIME_DISTRIBUTION)
19+ENDIF()
20+
21 OPTION(ENABLE_DEBUG_SYNC "Enable debug sync (debug builds only)" ON)
22 IF(ENABLE_DEBUG_SYNC)
23 SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DENABLED_DEBUG_SYNC")
db82db79
AM
24--- a/include/mysql_com.h
25+++ b/include/mysql_com.h
adf0fb13 26@@ -141,10 +141,11 @@
b4e1fa2c
AM
27 #define REFRESH_FAST 32768 /* Intern flag */
28
29 /* RESET (remove all queries) from query cache */
30-#define REFRESH_QUERY_CACHE 65536
31-#define REFRESH_QUERY_CACHE_FREE 0x20000L /* pack query cache */
32-#define REFRESH_DES_KEY_FILE 0x40000L
33-#define REFRESH_USER_RESOURCES 0x80000L
34+#define REFRESH_QUERY_CACHE 65536
35+#define REFRESH_QUERY_CACHE_FREE 0x20000L /* pack query cache */
36+#define REFRESH_DES_KEY_FILE 0x40000L
37+#define REFRESH_USER_RESOURCES 0x80000L
38+#define REFRESH_QUERY_RESPONSE_TIME 0x100000L /* response time distibution */
39
40 #define CLIENT_LONG_PASSWORD 1 /* new more secure passwords */
41 #define CLIENT_FOUND_ROWS 2 /* Found instead of affected rows */
db82db79 42--- /dev/null
48b678b4
AM
43+++ b/mysql-test/include/have_response_time_distribution.inc
44@@ -0,0 +1,4 @@
45+-- require r/have_response_time_distribution.require
46+disable_query_log;
47+show variables like 'have_response_time_distribution';
48+enable_query_log;
49--- /dev/null
50+++ b/mysql-test/include/query_response_time.inc
734d6226 51@@ -0,0 +1,43 @@
48b678b4
AM
52+SET SESSION query_exec_time=0.1;
53+
54+SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
55+EVAL SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=$base;
56+FLUSH QUERY_RESPONSE_TIME;
734d6226
AM
57+# Following two queries check works of FLUSH and
58+# respecting of "QUERY_RESPONSE_TIME_STATS" variable (see launchpad bug #855312)
59+SHOW QUERY_RESPONSE_TIME;
60+SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
48b678b4
AM
61+SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
62+
63+SET SESSION query_exec_time=0.31; SELECT 1;
64+SET SESSION query_exec_time=0.32; SELECT 1;
65+SET SESSION query_exec_time=0.33; SELECT 1;
66+SET SESSION query_exec_time=0.34; SELECT 1;
67+SET SESSION query_exec_time=0.35; SELECT 1;
68+SET SESSION query_exec_time=0.36; SELECT 1;
69+SET SESSION query_exec_time=0.37; SELECT 1;
70+SET SESSION query_exec_time=0.38; SELECT 1;
71+SET SESSION query_exec_time=0.39; SELECT 1;
72+SET SESSION query_exec_time=0.4; SELECT 1;
73+SET SESSION query_exec_time=1.1; SELECT 1;
74+SET SESSION query_exec_time=1.2; SELECT 1;
75+SET SESSION query_exec_time=1.3; SELECT 1;
76+SET SESSION query_exec_time=1.5; SELECT 1;
77+SET SESSION query_exec_time=1.4; SELECT 1;
78+SET SESSION query_exec_time=0.5; SELECT 1;
79+SET SESSION query_exec_time=2.1; SELECT 1;
80+SET SESSION query_exec_time=2.3; SELECT 1;
81+SET SESSION query_exec_time=2.5; SELECT 1;
82+SET SESSION query_exec_time=3.1; SELECT 1;
83+SET SESSION query_exec_time=4.1; SELECT 1;
84+SET SESSION query_exec_time=5.1; SELECT 1;
85+
86+SET SESSION query_exec_time=0.1;
87+
88+SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
89+
90+SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
91+SHOW QUERY_RESPONSE_TIME;
92+SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
93+
94+SET SESSION query_exec_time=default;
95--- /dev/null
96+++ b/mysql-test/include/query_response_time-replication.inc
97@@ -0,0 +1,57 @@
98+connection master;
99+
100+CREATE TABLE t(id INT);
101+
102+connection slave;
103+SET GLOBAL query_exec_time = 0.1;
104+--source include/restart_slave_sql.inc
105+
106+connection slave;
107+
108+SET SESSION query_exec_time=0.1;
109+
110+SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
111+--eval SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=$base
112+FLUSH QUERY_RESPONSE_TIME;
113+SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
114+
115+connection master;
116+
117+SET SESSION query_exec_time = 0.31; INSERT INTO t VALUES(1);
118+SET SESSION query_exec_time = 0.32; INSERT INTO t VALUES(1);
119+SET SESSION query_exec_time = 0.33; INSERT INTO t VALUES(1);
120+SET SESSION query_exec_time = 0.34; INSERT INTO t VALUES(1);
121+SET SESSION query_exec_time = 0.35; INSERT INTO t VALUES(1);
122+SET SESSION query_exec_time = 0.36; INSERT INTO t VALUES(1);
123+SET SESSION query_exec_time = 0.37; INSERT INTO t VALUES(1);
124+SET SESSION query_exec_time = 0.38; INSERT INTO t VALUES(1);
125+SET SESSION query_exec_time = 0.39; INSERT INTO t VALUES(1);
126+SET SESSION query_exec_time = 0.4; INSERT INTO t VALUES(1);
127+SET SESSION query_exec_time = 1.1; INSERT INTO t VALUES(1);
128+SET SESSION query_exec_time = 1.2; INSERT INTO t VALUES(1);
129+SET SESSION query_exec_time = 1.3; INSERT INTO t VALUES(1);
130+SET SESSION query_exec_time = 1.5; INSERT INTO t VALUES(1);
131+SET SESSION query_exec_time = 1.4; INSERT INTO t VALUES(1);
132+SET SESSION query_exec_time = 0.5; INSERT INTO t VALUES(1);
133+SET SESSION query_exec_time = 2.1; INSERT INTO t VALUES(1);
134+SET SESSION query_exec_time = 2.3; INSERT INTO t VALUES(1);
135+SET SESSION query_exec_time = 2.5; INSERT INTO t VALUES(1);
136+SET SESSION query_exec_time = 3.1; INSERT INTO t VALUES(1);
137+SET SESSION query_exec_time = 4.1; INSERT INTO t VALUES(1);
138+SET SESSION query_exec_time = 5.1; INSERT INTO t VALUES(1);
139+
140+sync_slave_with_master;
141+
142+connection slave;
143+SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
144+SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
145+SHOW QUERY_RESPONSE_TIME;
146+SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
147+
148+SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=default;
149+SET GLOBAL QUERY_RESPONSE_TIME_STATS=default;
150+
151+connection master;
152+DROP TABLE t;
153+
154+sync_slave_with_master;
155--- /dev/null
156+++ b/mysql-test/include/query_response_time-stored.inc
157@@ -0,0 +1,37 @@
158+SET SESSION query_exec_time=0.1;
159+
160+SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
161+EVAL SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=$base;
162+FLUSH QUERY_RESPONSE_TIME;
163+SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
164+
165+CALL test_f(0.31);
166+CALL test_f(0.32);
167+CALL test_f(0.33);
168+CALL test_f(0.34);
169+CALL test_f(0.35);
170+CALL test_f(0.36);
171+CALL test_f(0.37);
172+CALL test_f(0.38);
173+CALL test_f(0.39);
174+CALL test_f(0.4);
175+CALL test_f(1.1);
176+CALL test_f(1.2);
177+CALL test_f(1.3);
178+CALL test_f(1.5);
179+CALL test_f(1.4);
180+CALL test_f(0.5);
181+CALL test_f(2.1);
182+CALL test_f(2.3);
183+CALL test_f(2.5);
184+CALL test_f(3.1);
185+CALL test_f(4.1);
186+CALL test_f(5.1);
187+
188+SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
189+
190+SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
191+SHOW QUERY_RESPONSE_TIME;
192+SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
193+
194+SET SESSION query_exec_time=default;
195--- /dev/null
196+++ b/mysql-test/r/percona_query_response_time-replication.result
197@@ -0,0 +1,727 @@
198+SET GLOBAL query_exec_time=0.1;
199+include/master-slave.inc
200+[connection master]
201+CREATE TABLE t(id INT);
202+SET GLOBAL query_exec_time = 0.1;
203+include/restart_slave.inc
204+SET SESSION query_exec_time=0.1;
205+SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
206+SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=1;
207+Warnings:
208+Warning 1292 Truncated incorrect query_response_time_range_base value: '1'
209+FLUSH QUERY_RESPONSE_TIME;
210+SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
211+SET SESSION query_exec_time = 0.31;
212+INSERT INTO t VALUES(1);
213+SET SESSION query_exec_time = 0.32;
214+INSERT INTO t VALUES(1);
215+SET SESSION query_exec_time = 0.33;
216+INSERT INTO t VALUES(1);
217+SET SESSION query_exec_time = 0.34;
218+INSERT INTO t VALUES(1);
219+SET SESSION query_exec_time = 0.35;
220+INSERT INTO t VALUES(1);
221+SET SESSION query_exec_time = 0.36;
222+INSERT INTO t VALUES(1);
223+SET SESSION query_exec_time = 0.37;
224+INSERT INTO t VALUES(1);
225+SET SESSION query_exec_time = 0.38;
226+INSERT INTO t VALUES(1);
227+SET SESSION query_exec_time = 0.39;
228+INSERT INTO t VALUES(1);
229+SET SESSION query_exec_time = 0.4;
230+INSERT INTO t VALUES(1);
231+SET SESSION query_exec_time = 1.1;
232+INSERT INTO t VALUES(1);
233+SET SESSION query_exec_time = 1.2;
234+INSERT INTO t VALUES(1);
235+SET SESSION query_exec_time = 1.3;
236+INSERT INTO t VALUES(1);
237+SET SESSION query_exec_time = 1.5;
238+INSERT INTO t VALUES(1);
239+SET SESSION query_exec_time = 1.4;
240+INSERT INTO t VALUES(1);
241+SET SESSION query_exec_time = 0.5;
242+INSERT INTO t VALUES(1);
243+SET SESSION query_exec_time = 2.1;
244+INSERT INTO t VALUES(1);
245+SET SESSION query_exec_time = 2.3;
246+INSERT INTO t VALUES(1);
247+SET SESSION query_exec_time = 2.5;
248+INSERT INTO t VALUES(1);
249+SET SESSION query_exec_time = 3.1;
250+INSERT INTO t VALUES(1);
251+SET SESSION query_exec_time = 4.1;
252+INSERT INTO t VALUES(1);
253+SET SESSION query_exec_time = 5.1;
254+INSERT INTO t VALUES(1);
255+SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
256+SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
257+Variable_name Value
258+query_response_time_range_base 2
259+SHOW QUERY_RESPONSE_TIME;
260+
734d6226 261+ 0.000001 1 0.000000
48b678b4
AM
262+ 0.000003 0 0.000000
263+ 0.000007 0 0.000000
264+ 0.000015 0 0.000000
265+ 0.000030 0 0.000000
266+ 0.000061 0 0.000000
267+ 0.000122 0 0.000000
268+ 0.000244 0 0.000000
269+ 0.000488 0 0.000000
270+ 0.000976 0 0.000000
271+ 0.001953 0 0.000000
272+ 0.003906 0 0.000000
273+ 0.007812 0 0.000000
274+ 0.015625 0 0.000000
275+ 0.031250 0 0.000000
276+ 0.062500 0 0.000000
734d6226 277+ 0.125000 1 0.100000
48b678b4
AM
278+ 0.250000 0 0.000000
279+ 0.500000 30 10.650000
280+ 1.000000 3 1.500000
281+ 2.000000 15 19.500000
282+ 4.000000 12 30.000000
283+ 8.000000 6 27.599997
284+ 16.000000 0 0.000000
285+ 32.000000 0 0.000000
286+ 64.000000 0 0.000000
287+ 128.000000 0 0.000000
288+ 256.000000 0 0.000000
289+ 512.000000 0 0.000000
290+ 1024.000000 0 0.000000
291+ 2048.000000 0 0.000000
292+ 4096.000000 0 0.000000
293+ 8192.000000 0 0.000000
294+ 16384.000000 0 0.000000
295+ 32768.000000 0 0.000000
296+ 65536.000000 0 0.000000
297+ 131072.000000 0 0.000000
298+ 262144.000000 0 0.000000
299+ 524288.000000 0 0.000000
9dd04cbc
AM
300+1048576.000000 0 0.000000
301+2097152.000000 0 0.000000
302+4194304.000000 0 0.000000
303+8388608.000000 0 0.000000
48b678b4
AM
304+TOO LONG 0 TOO LONG
305+SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
306+time count total
734d6226 307+ 0.000001 1 0.000000
48b678b4
AM
308+ 0.000003 0 0.000000
309+ 0.000007 0 0.000000
310+ 0.000015 0 0.000000
311+ 0.000030 0 0.000000
312+ 0.000061 0 0.000000
313+ 0.000122 0 0.000000
314+ 0.000244 0 0.000000
315+ 0.000488 0 0.000000
316+ 0.000976 0 0.000000
317+ 0.001953 0 0.000000
318+ 0.003906 0 0.000000
319+ 0.007812 0 0.000000
320+ 0.015625 0 0.000000
321+ 0.031250 0 0.000000
322+ 0.062500 0 0.000000
734d6226 323+ 0.125000 1 0.100000
48b678b4
AM
324+ 0.250000 0 0.000000
325+ 0.500000 30 10.650000
326+ 1.000000 3 1.500000
327+ 2.000000 15 19.500000
328+ 4.000000 12 30.000000
329+ 8.000000 6 27.599997
330+ 16.000000 0 0.000000
331+ 32.000000 0 0.000000
332+ 64.000000 0 0.000000
333+ 128.000000 0 0.000000
334+ 256.000000 0 0.000000
335+ 512.000000 0 0.000000
336+ 1024.000000 0 0.000000
337+ 2048.000000 0 0.000000
338+ 4096.000000 0 0.000000
339+ 8192.000000 0 0.000000
340+ 16384.000000 0 0.000000
341+ 32768.000000 0 0.000000
342+ 65536.000000 0 0.000000
343+ 131072.000000 0 0.000000
344+ 262144.000000 0 0.000000
345+ 524288.000000 0 0.000000
9dd04cbc
AM
346+1048576.000000 0 0.000000
347+2097152.000000 0 0.000000
348+4194304.000000 0 0.000000
349+8388608.000000 0 0.000000
48b678b4
AM
350+TOO LONG 0 TOO LONG
351+SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=default;
352+SET GLOBAL QUERY_RESPONSE_TIME_STATS=default;
353+DROP TABLE t;
354+CREATE TABLE t(id INT);
355+SET GLOBAL query_exec_time = 0.1;
356+include/restart_slave.inc
357+SET SESSION query_exec_time=0.1;
358+SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
359+SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=2;
360+FLUSH QUERY_RESPONSE_TIME;
361+SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
362+SET SESSION query_exec_time = 0.31;
363+INSERT INTO t VALUES(1);
364+SET SESSION query_exec_time = 0.32;
365+INSERT INTO t VALUES(1);
366+SET SESSION query_exec_time = 0.33;
367+INSERT INTO t VALUES(1);
368+SET SESSION query_exec_time = 0.34;
369+INSERT INTO t VALUES(1);
370+SET SESSION query_exec_time = 0.35;
371+INSERT INTO t VALUES(1);
372+SET SESSION query_exec_time = 0.36;
373+INSERT INTO t VALUES(1);
374+SET SESSION query_exec_time = 0.37;
375+INSERT INTO t VALUES(1);
376+SET SESSION query_exec_time = 0.38;
377+INSERT INTO t VALUES(1);
378+SET SESSION query_exec_time = 0.39;
379+INSERT INTO t VALUES(1);
380+SET SESSION query_exec_time = 0.4;
381+INSERT INTO t VALUES(1);
382+SET SESSION query_exec_time = 1.1;
383+INSERT INTO t VALUES(1);
384+SET SESSION query_exec_time = 1.2;
385+INSERT INTO t VALUES(1);
386+SET SESSION query_exec_time = 1.3;
387+INSERT INTO t VALUES(1);
388+SET SESSION query_exec_time = 1.5;
389+INSERT INTO t VALUES(1);
390+SET SESSION query_exec_time = 1.4;
391+INSERT INTO t VALUES(1);
392+SET SESSION query_exec_time = 0.5;
393+INSERT INTO t VALUES(1);
394+SET SESSION query_exec_time = 2.1;
395+INSERT INTO t VALUES(1);
396+SET SESSION query_exec_time = 2.3;
397+INSERT INTO t VALUES(1);
398+SET SESSION query_exec_time = 2.5;
399+INSERT INTO t VALUES(1);
400+SET SESSION query_exec_time = 3.1;
401+INSERT INTO t VALUES(1);
402+SET SESSION query_exec_time = 4.1;
403+INSERT INTO t VALUES(1);
404+SET SESSION query_exec_time = 5.1;
405+INSERT INTO t VALUES(1);
406+SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
407+SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
408+Variable_name Value
409+query_response_time_range_base 2
410+SHOW QUERY_RESPONSE_TIME;
411+
734d6226 412+ 0.000001 1 0.000000
48b678b4
AM
413+ 0.000003 0 0.000000
414+ 0.000007 0 0.000000
415+ 0.000015 0 0.000000
416+ 0.000030 0 0.000000
417+ 0.000061 0 0.000000
418+ 0.000122 0 0.000000
419+ 0.000244 0 0.000000
420+ 0.000488 0 0.000000
421+ 0.000976 0 0.000000
422+ 0.001953 0 0.000000
423+ 0.003906 0 0.000000
424+ 0.007812 0 0.000000
425+ 0.015625 0 0.000000
426+ 0.031250 0 0.000000
427+ 0.062500 0 0.000000
734d6226 428+ 0.125000 1 0.100000
48b678b4
AM
429+ 0.250000 0 0.000000
430+ 0.500000 30 10.650000
431+ 1.000000 3 1.500000
432+ 2.000000 15 19.500000
433+ 4.000000 12 30.000000
434+ 8.000000 6 27.599997
435+ 16.000000 0 0.000000
436+ 32.000000 0 0.000000
437+ 64.000000 0 0.000000
438+ 128.000000 0 0.000000
439+ 256.000000 0 0.000000
440+ 512.000000 0 0.000000
441+ 1024.000000 0 0.000000
442+ 2048.000000 0 0.000000
443+ 4096.000000 0 0.000000
444+ 8192.000000 0 0.000000
445+ 16384.000000 0 0.000000
446+ 32768.000000 0 0.000000
447+ 65536.000000 0 0.000000
448+ 131072.000000 0 0.000000
449+ 262144.000000 0 0.000000
450+ 524288.000000 0 0.000000
9dd04cbc
AM
451+1048576.000000 0 0.000000
452+2097152.000000 0 0.000000
453+4194304.000000 0 0.000000
454+8388608.000000 0 0.000000
48b678b4
AM
455+TOO LONG 0 TOO LONG
456+SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
457+time count total
734d6226 458+ 0.000001 1 0.000000
48b678b4
AM
459+ 0.000003 0 0.000000
460+ 0.000007 0 0.000000
461+ 0.000015 0 0.000000
462+ 0.000030 0 0.000000
463+ 0.000061 0 0.000000
464+ 0.000122 0 0.000000
465+ 0.000244 0 0.000000
466+ 0.000488 0 0.000000
467+ 0.000976 0 0.000000
468+ 0.001953 0 0.000000
469+ 0.003906 0 0.000000
470+ 0.007812 0 0.000000
471+ 0.015625 0 0.000000
472+ 0.031250 0 0.000000
473+ 0.062500 0 0.000000
734d6226 474+ 0.125000 1 0.100000
48b678b4
AM
475+ 0.250000 0 0.000000
476+ 0.500000 30 10.650000
477+ 1.000000 3 1.500000
478+ 2.000000 15 19.500000
479+ 4.000000 12 30.000000
480+ 8.000000 6 27.599997
481+ 16.000000 0 0.000000
482+ 32.000000 0 0.000000
483+ 64.000000 0 0.000000
484+ 128.000000 0 0.000000
485+ 256.000000 0 0.000000
486+ 512.000000 0 0.000000
487+ 1024.000000 0 0.000000
488+ 2048.000000 0 0.000000
489+ 4096.000000 0 0.000000
490+ 8192.000000 0 0.000000
491+ 16384.000000 0 0.000000
492+ 32768.000000 0 0.000000
493+ 65536.000000 0 0.000000
494+ 131072.000000 0 0.000000
495+ 262144.000000 0 0.000000
496+ 524288.000000 0 0.000000
9dd04cbc
AM
497+1048576.000000 0 0.000000
498+2097152.000000 0 0.000000
499+4194304.000000 0 0.000000
500+8388608.000000 0 0.000000
48b678b4
AM
501+TOO LONG 0 TOO LONG
502+SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=default;
503+SET GLOBAL QUERY_RESPONSE_TIME_STATS=default;
504+DROP TABLE t;
505+CREATE TABLE t(id INT);
506+SET GLOBAL query_exec_time = 0.1;
507+include/restart_slave.inc
508+SET SESSION query_exec_time=0.1;
509+SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
510+SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=10;
511+FLUSH QUERY_RESPONSE_TIME;
512+SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
513+SET SESSION query_exec_time = 0.31;
514+INSERT INTO t VALUES(1);
515+SET SESSION query_exec_time = 0.32;
516+INSERT INTO t VALUES(1);
517+SET SESSION query_exec_time = 0.33;
518+INSERT INTO t VALUES(1);
519+SET SESSION query_exec_time = 0.34;
520+INSERT INTO t VALUES(1);
521+SET SESSION query_exec_time = 0.35;
522+INSERT INTO t VALUES(1);
523+SET SESSION query_exec_time = 0.36;
524+INSERT INTO t VALUES(1);
525+SET SESSION query_exec_time = 0.37;
526+INSERT INTO t VALUES(1);
527+SET SESSION query_exec_time = 0.38;
528+INSERT INTO t VALUES(1);
529+SET SESSION query_exec_time = 0.39;
530+INSERT INTO t VALUES(1);
531+SET SESSION query_exec_time = 0.4;
532+INSERT INTO t VALUES(1);
533+SET SESSION query_exec_time = 1.1;
534+INSERT INTO t VALUES(1);
535+SET SESSION query_exec_time = 1.2;
536+INSERT INTO t VALUES(1);
537+SET SESSION query_exec_time = 1.3;
538+INSERT INTO t VALUES(1);
539+SET SESSION query_exec_time = 1.5;
540+INSERT INTO t VALUES(1);
541+SET SESSION query_exec_time = 1.4;
542+INSERT INTO t VALUES(1);
543+SET SESSION query_exec_time = 0.5;
544+INSERT INTO t VALUES(1);
545+SET SESSION query_exec_time = 2.1;
546+INSERT INTO t VALUES(1);
547+SET SESSION query_exec_time = 2.3;
548+INSERT INTO t VALUES(1);
549+SET SESSION query_exec_time = 2.5;
550+INSERT INTO t VALUES(1);
551+SET SESSION query_exec_time = 3.1;
552+INSERT INTO t VALUES(1);
553+SET SESSION query_exec_time = 4.1;
554+INSERT INTO t VALUES(1);
555+SET SESSION query_exec_time = 5.1;
556+INSERT INTO t VALUES(1);
557+SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
558+SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
559+Variable_name Value
560+query_response_time_range_base 10
561+SHOW QUERY_RESPONSE_TIME;
562+
734d6226 563+ 0.000001 1 0.000000
48b678b4
AM
564+ 0.000010 0 0.000000
565+ 0.000100 0 0.000000
566+ 0.001000 0 0.000000
567+ 0.010000 0 0.000000
568+ 0.100000 0 0.000000
734d6226 569+ 1.000000 34 12.250000
48b678b4
AM
570+ 10.000000 33 77.099997
571+ 100.000000 0 0.000000
572+ 1000.000000 0 0.000000
573+ 10000.000000 0 0.000000
574+ 100000.000000 0 0.000000
9dd04cbc 575+1000000.000000 0 0.000000
48b678b4
AM
576+TOO LONG 0 TOO LONG
577+SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
578+time count total
734d6226 579+ 0.000001 1 0.000000
48b678b4
AM
580+ 0.000010 0 0.000000
581+ 0.000100 0 0.000000
582+ 0.001000 0 0.000000
583+ 0.010000 0 0.000000
584+ 0.100000 0 0.000000
734d6226 585+ 1.000000 34 12.250000
48b678b4
AM
586+ 10.000000 33 77.099997
587+ 100.000000 0 0.000000
588+ 1000.000000 0 0.000000
589+ 10000.000000 0 0.000000
590+ 100000.000000 0 0.000000
9dd04cbc 591+1000000.000000 0 0.000000
48b678b4
AM
592+TOO LONG 0 TOO LONG
593+SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=default;
594+SET GLOBAL QUERY_RESPONSE_TIME_STATS=default;
595+DROP TABLE t;
596+CREATE TABLE t(id INT);
597+SET GLOBAL query_exec_time = 0.1;
598+include/restart_slave.inc
599+SET SESSION query_exec_time=0.1;
600+SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
601+SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=7;
602+FLUSH QUERY_RESPONSE_TIME;
603+SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
604+SET SESSION query_exec_time = 0.31;
605+INSERT INTO t VALUES(1);
606+SET SESSION query_exec_time = 0.32;
607+INSERT INTO t VALUES(1);
608+SET SESSION query_exec_time = 0.33;
609+INSERT INTO t VALUES(1);
610+SET SESSION query_exec_time = 0.34;
611+INSERT INTO t VALUES(1);
612+SET SESSION query_exec_time = 0.35;
613+INSERT INTO t VALUES(1);
614+SET SESSION query_exec_time = 0.36;
615+INSERT INTO t VALUES(1);
616+SET SESSION query_exec_time = 0.37;
617+INSERT INTO t VALUES(1);
618+SET SESSION query_exec_time = 0.38;
619+INSERT INTO t VALUES(1);
620+SET SESSION query_exec_time = 0.39;
621+INSERT INTO t VALUES(1);
622+SET SESSION query_exec_time = 0.4;
623+INSERT INTO t VALUES(1);
624+SET SESSION query_exec_time = 1.1;
625+INSERT INTO t VALUES(1);
626+SET SESSION query_exec_time = 1.2;
627+INSERT INTO t VALUES(1);
628+SET SESSION query_exec_time = 1.3;
629+INSERT INTO t VALUES(1);
630+SET SESSION query_exec_time = 1.5;
631+INSERT INTO t VALUES(1);
632+SET SESSION query_exec_time = 1.4;
633+INSERT INTO t VALUES(1);
634+SET SESSION query_exec_time = 0.5;
635+INSERT INTO t VALUES(1);
636+SET SESSION query_exec_time = 2.1;
637+INSERT INTO t VALUES(1);
638+SET SESSION query_exec_time = 2.3;
639+INSERT INTO t VALUES(1);
640+SET SESSION query_exec_time = 2.5;
641+INSERT INTO t VALUES(1);
642+SET SESSION query_exec_time = 3.1;
643+INSERT INTO t VALUES(1);
644+SET SESSION query_exec_time = 4.1;
645+INSERT INTO t VALUES(1);
646+SET SESSION query_exec_time = 5.1;
647+INSERT INTO t VALUES(1);
648+SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
649+SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
650+Variable_name Value
651+query_response_time_range_base 7
652+SHOW QUERY_RESPONSE_TIME;
653+
734d6226 654+ 0.000001 1 0.000000
48b678b4
AM
655+ 0.000008 0 0.000000
656+ 0.000059 0 0.000000
657+ 0.000416 0 0.000000
658+ 0.002915 0 0.000000
659+ 0.020408 0 0.000000
734d6226 660+ 0.142857 1 0.100000
48b678b4
AM
661+ 1.000000 33 12.150000
662+ 7.000000 33 77.099997
663+ 49.000000 0 0.000000
664+ 343.000000 0 0.000000
665+ 2401.000000 0 0.000000
666+ 16807.000000 0 0.000000
667+ 117649.000000 0 0.000000
668+ 823543.000000 0 0.000000
9dd04cbc 669+5764801.000000 0 0.000000
48b678b4
AM
670+TOO LONG 0 TOO LONG
671+SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
672+time count total
734d6226 673+ 0.000001 1 0.000000
48b678b4
AM
674+ 0.000008 0 0.000000
675+ 0.000059 0 0.000000
676+ 0.000416 0 0.000000
677+ 0.002915 0 0.000000
678+ 0.020408 0 0.000000
734d6226 679+ 0.142857 1 0.100000
48b678b4
AM
680+ 1.000000 33 12.150000
681+ 7.000000 33 77.099997
682+ 49.000000 0 0.000000
683+ 343.000000 0 0.000000
684+ 2401.000000 0 0.000000
685+ 16807.000000 0 0.000000
686+ 117649.000000 0 0.000000
687+ 823543.000000 0 0.000000
9dd04cbc 688+5764801.000000 0 0.000000
48b678b4
AM
689+TOO LONG 0 TOO LONG
690+SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=default;
691+SET GLOBAL QUERY_RESPONSE_TIME_STATS=default;
692+DROP TABLE t;
693+CREATE TABLE t(id INT);
694+SET GLOBAL query_exec_time = 0.1;
695+include/restart_slave.inc
696+SET SESSION query_exec_time=0.1;
697+SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
698+SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=156;
699+FLUSH QUERY_RESPONSE_TIME;
700+SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
701+SET SESSION query_exec_time = 0.31;
702+INSERT INTO t VALUES(1);
703+SET SESSION query_exec_time = 0.32;
704+INSERT INTO t VALUES(1);
705+SET SESSION query_exec_time = 0.33;
706+INSERT INTO t VALUES(1);
707+SET SESSION query_exec_time = 0.34;
708+INSERT INTO t VALUES(1);
709+SET SESSION query_exec_time = 0.35;
710+INSERT INTO t VALUES(1);
711+SET SESSION query_exec_time = 0.36;
712+INSERT INTO t VALUES(1);
713+SET SESSION query_exec_time = 0.37;
714+INSERT INTO t VALUES(1);
715+SET SESSION query_exec_time = 0.38;
716+INSERT INTO t VALUES(1);
717+SET SESSION query_exec_time = 0.39;
718+INSERT INTO t VALUES(1);
719+SET SESSION query_exec_time = 0.4;
720+INSERT INTO t VALUES(1);
721+SET SESSION query_exec_time = 1.1;
722+INSERT INTO t VALUES(1);
723+SET SESSION query_exec_time = 1.2;
724+INSERT INTO t VALUES(1);
725+SET SESSION query_exec_time = 1.3;
726+INSERT INTO t VALUES(1);
727+SET SESSION query_exec_time = 1.5;
728+INSERT INTO t VALUES(1);
729+SET SESSION query_exec_time = 1.4;
730+INSERT INTO t VALUES(1);
731+SET SESSION query_exec_time = 0.5;
732+INSERT INTO t VALUES(1);
733+SET SESSION query_exec_time = 2.1;
734+INSERT INTO t VALUES(1);
735+SET SESSION query_exec_time = 2.3;
736+INSERT INTO t VALUES(1);
737+SET SESSION query_exec_time = 2.5;
738+INSERT INTO t VALUES(1);
739+SET SESSION query_exec_time = 3.1;
740+INSERT INTO t VALUES(1);
741+SET SESSION query_exec_time = 4.1;
742+INSERT INTO t VALUES(1);
743+SET SESSION query_exec_time = 5.1;
744+INSERT INTO t VALUES(1);
745+SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
746+SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
747+Variable_name Value
748+query_response_time_range_base 156
749+SHOW QUERY_RESPONSE_TIME;
750+
734d6226 751+ 0.000041 1 0.000000
48b678b4 752+ 0.006410 0 0.000000
734d6226 753+ 1.000000 34 12.250000
48b678b4
AM
754+ 156.000000 33 77.099997
755+ 24336.000000 0 0.000000
9dd04cbc 756+3796416.000000 0 0.000000
48b678b4
AM
757+TOO LONG 0 TOO LONG
758+SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
759+time count total
734d6226 760+ 0.000041 1 0.000000
48b678b4 761+ 0.006410 0 0.000000
734d6226 762+ 1.000000 34 12.250000
48b678b4
AM
763+ 156.000000 33 77.099997
764+ 24336.000000 0 0.000000
9dd04cbc 765+3796416.000000 0 0.000000
48b678b4
AM
766+TOO LONG 0 TOO LONG
767+SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=default;
768+SET GLOBAL QUERY_RESPONSE_TIME_STATS=default;
769+DROP TABLE t;
770+CREATE TABLE t(id INT);
771+SET GLOBAL query_exec_time = 0.1;
772+include/restart_slave.inc
773+SET SESSION query_exec_time=0.1;
774+SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
775+SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=1000;
776+FLUSH QUERY_RESPONSE_TIME;
777+SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
778+SET SESSION query_exec_time = 0.31;
779+INSERT INTO t VALUES(1);
780+SET SESSION query_exec_time = 0.32;
781+INSERT INTO t VALUES(1);
782+SET SESSION query_exec_time = 0.33;
783+INSERT INTO t VALUES(1);
784+SET SESSION query_exec_time = 0.34;
785+INSERT INTO t VALUES(1);
786+SET SESSION query_exec_time = 0.35;
787+INSERT INTO t VALUES(1);
788+SET SESSION query_exec_time = 0.36;
789+INSERT INTO t VALUES(1);
790+SET SESSION query_exec_time = 0.37;
791+INSERT INTO t VALUES(1);
792+SET SESSION query_exec_time = 0.38;
793+INSERT INTO t VALUES(1);
794+SET SESSION query_exec_time = 0.39;
795+INSERT INTO t VALUES(1);
796+SET SESSION query_exec_time = 0.4;
797+INSERT INTO t VALUES(1);
798+SET SESSION query_exec_time = 1.1;
799+INSERT INTO t VALUES(1);
800+SET SESSION query_exec_time = 1.2;
801+INSERT INTO t VALUES(1);
802+SET SESSION query_exec_time = 1.3;
803+INSERT INTO t VALUES(1);
804+SET SESSION query_exec_time = 1.5;
805+INSERT INTO t VALUES(1);
806+SET SESSION query_exec_time = 1.4;
807+INSERT INTO t VALUES(1);
808+SET SESSION query_exec_time = 0.5;
809+INSERT INTO t VALUES(1);
810+SET SESSION query_exec_time = 2.1;
811+INSERT INTO t VALUES(1);
812+SET SESSION query_exec_time = 2.3;
813+INSERT INTO t VALUES(1);
814+SET SESSION query_exec_time = 2.5;
815+INSERT INTO t VALUES(1);
816+SET SESSION query_exec_time = 3.1;
817+INSERT INTO t VALUES(1);
818+SET SESSION query_exec_time = 4.1;
819+INSERT INTO t VALUES(1);
820+SET SESSION query_exec_time = 5.1;
821+INSERT INTO t VALUES(1);
822+SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
823+SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
824+Variable_name Value
825+query_response_time_range_base 1000
826+SHOW QUERY_RESPONSE_TIME;
827+
734d6226 828+ 0.000001 1 0.000000
48b678b4 829+ 0.001000 0 0.000000
734d6226 830+ 1.000000 34 12.250000
48b678b4 831+ 1000.000000 33 77.099997
9dd04cbc 832+1000000.000000 0 0.000000
48b678b4
AM
833+TOO LONG 0 TOO LONG
834+SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
835+time count total
734d6226 836+ 0.000001 1 0.000000
48b678b4 837+ 0.001000 0 0.000000
734d6226 838+ 1.000000 34 12.250000
48b678b4 839+ 1000.000000 33 77.099997
9dd04cbc 840+1000000.000000 0 0.000000
48b678b4
AM
841+TOO LONG 0 TOO LONG
842+SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=default;
843+SET GLOBAL QUERY_RESPONSE_TIME_STATS=default;
844+DROP TABLE t;
845+CREATE TABLE t(id INT);
846+SET GLOBAL query_exec_time = 0.1;
847+include/restart_slave.inc
848+SET SESSION query_exec_time=0.1;
849+SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
850+SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=1001;
851+Warnings:
852+Warning 1292 Truncated incorrect query_response_time_range_base value: '1001'
853+FLUSH QUERY_RESPONSE_TIME;
854+SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
855+SET SESSION query_exec_time = 0.31;
856+INSERT INTO t VALUES(1);
857+SET SESSION query_exec_time = 0.32;
858+INSERT INTO t VALUES(1);
859+SET SESSION query_exec_time = 0.33;
860+INSERT INTO t VALUES(1);
861+SET SESSION query_exec_time = 0.34;
862+INSERT INTO t VALUES(1);
863+SET SESSION query_exec_time = 0.35;
864+INSERT INTO t VALUES(1);
865+SET SESSION query_exec_time = 0.36;
866+INSERT INTO t VALUES(1);
867+SET SESSION query_exec_time = 0.37;
868+INSERT INTO t VALUES(1);
869+SET SESSION query_exec_time = 0.38;
870+INSERT INTO t VALUES(1);
871+SET SESSION query_exec_time = 0.39;
872+INSERT INTO t VALUES(1);
873+SET SESSION query_exec_time = 0.4;
874+INSERT INTO t VALUES(1);
875+SET SESSION query_exec_time = 1.1;
876+INSERT INTO t VALUES(1);
877+SET SESSION query_exec_time = 1.2;
878+INSERT INTO t VALUES(1);
879+SET SESSION query_exec_time = 1.3;
880+INSERT INTO t VALUES(1);
881+SET SESSION query_exec_time = 1.5;
882+INSERT INTO t VALUES(1);
883+SET SESSION query_exec_time = 1.4;
884+INSERT INTO t VALUES(1);
885+SET SESSION query_exec_time = 0.5;
886+INSERT INTO t VALUES(1);
887+SET SESSION query_exec_time = 2.1;
888+INSERT INTO t VALUES(1);
889+SET SESSION query_exec_time = 2.3;
890+INSERT INTO t VALUES(1);
891+SET SESSION query_exec_time = 2.5;
892+INSERT INTO t VALUES(1);
893+SET SESSION query_exec_time = 3.1;
894+INSERT INTO t VALUES(1);
895+SET SESSION query_exec_time = 4.1;
896+INSERT INTO t VALUES(1);
897+SET SESSION query_exec_time = 5.1;
898+INSERT INTO t VALUES(1);
899+SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
900+SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
901+Variable_name Value
902+query_response_time_range_base 1000
903+SHOW QUERY_RESPONSE_TIME;
904+
734d6226 905+ 0.000001 1 0.000000
48b678b4 906+ 0.001000 0 0.000000
734d6226 907+ 1.000000 34 12.250000
48b678b4 908+ 1000.000000 33 77.099997
9dd04cbc 909+1000000.000000 0 0.000000
48b678b4
AM
910+TOO LONG 0 TOO LONG
911+SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
912+time count total
734d6226 913+ 0.000001 1 0.000000
48b678b4 914+ 0.001000 0 0.000000
734d6226 915+ 1.000000 34 12.250000
48b678b4 916+ 1000.000000 33 77.099997
9dd04cbc 917+1000000.000000 0 0.000000
48b678b4
AM
918+TOO LONG 0 TOO LONG
919+SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=default;
920+SET GLOBAL QUERY_RESPONSE_TIME_STATS=default;
921+DROP TABLE t;
922+include/rpl_end.inc
923+SET GLOBAL query_exec_time=default;
924+SET GLOBAL query_exec_time=default;
925--- /dev/null
926+++ b/mysql-test/r/percona_query_response_time.result
734d6226 927@@ -0,0 +1,1307 @@
48b678b4
AM
928+SET SESSION query_exec_time=0.1;
929+SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
930+SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=1;
931+Warnings:
932+Warning 1292 Truncated incorrect query_response_time_range_base value: '1'
933+FLUSH QUERY_RESPONSE_TIME;
734d6226
AM
934+SHOW QUERY_RESPONSE_TIME;
935+
936+ 0.000001 0 0.000000
937+ 0.000003 0 0.000000
938+ 0.000007 0 0.000000
939+ 0.000015 0 0.000000
940+ 0.000030 0 0.000000
941+ 0.000061 0 0.000000
942+ 0.000122 0 0.000000
943+ 0.000244 0 0.000000
944+ 0.000488 0 0.000000
945+ 0.000976 0 0.000000
946+ 0.001953 0 0.000000
947+ 0.003906 0 0.000000
948+ 0.007812 0 0.000000
949+ 0.015625 0 0.000000
950+ 0.031250 0 0.000000
951+ 0.062500 0 0.000000
952+ 0.125000 0 0.000000
953+ 0.250000 0 0.000000
954+ 0.500000 0 0.000000
955+ 1.000000 0 0.000000
956+ 2.000000 0 0.000000
957+ 4.000000 0 0.000000
958+ 8.000000 0 0.000000
959+ 16.000000 0 0.000000
960+ 32.000000 0 0.000000
961+ 64.000000 0 0.000000
962+ 128.000000 0 0.000000
963+ 256.000000 0 0.000000
964+ 512.000000 0 0.000000
965+ 1024.000000 0 0.000000
966+ 2048.000000 0 0.000000
967+ 4096.000000 0 0.000000
968+ 8192.000000 0 0.000000
969+ 16384.000000 0 0.000000
970+ 32768.000000 0 0.000000
971+ 65536.000000 0 0.000000
972+ 131072.000000 0 0.000000
973+ 262144.000000 0 0.000000
974+ 524288.000000 0 0.000000
9dd04cbc
AM
975+1048576.000000 0 0.000000
976+2097152.000000 0 0.000000
977+4194304.000000 0 0.000000
978+8388608.000000 0 0.000000
734d6226
AM
979+TOO LONG 0 TOO LONG
980+SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
981+time count total
982+ 0.000001 0 0.000000
983+ 0.000003 0 0.000000
984+ 0.000007 0 0.000000
985+ 0.000015 0 0.000000
986+ 0.000030 0 0.000000
987+ 0.000061 0 0.000000
988+ 0.000122 0 0.000000
989+ 0.000244 0 0.000000
990+ 0.000488 0 0.000000
991+ 0.000976 0 0.000000
992+ 0.001953 0 0.000000
993+ 0.003906 0 0.000000
994+ 0.007812 0 0.000000
995+ 0.015625 0 0.000000
996+ 0.031250 0 0.000000
997+ 0.062500 0 0.000000
998+ 0.125000 0 0.000000
999+ 0.250000 0 0.000000
1000+ 0.500000 0 0.000000
1001+ 1.000000 0 0.000000
1002+ 2.000000 0 0.000000
1003+ 4.000000 0 0.000000
1004+ 8.000000 0 0.000000
1005+ 16.000000 0 0.000000
1006+ 32.000000 0 0.000000
1007+ 64.000000 0 0.000000
1008+ 128.000000 0 0.000000
1009+ 256.000000 0 0.000000
1010+ 512.000000 0 0.000000
1011+ 1024.000000 0 0.000000
1012+ 2048.000000 0 0.000000
1013+ 4096.000000 0 0.000000
1014+ 8192.000000 0 0.000000
1015+ 16384.000000 0 0.000000
1016+ 32768.000000 0 0.000000
1017+ 65536.000000 0 0.000000
1018+ 131072.000000 0 0.000000
1019+ 262144.000000 0 0.000000
1020+ 524288.000000 0 0.000000
9dd04cbc
AM
1021+1048576.000000 0 0.000000
1022+2097152.000000 0 0.000000
1023+4194304.000000 0 0.000000
1024+8388608.000000 0 0.000000
734d6226 1025+TOO LONG 0 TOO LONG
48b678b4
AM
1026+SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
1027+SET SESSION query_exec_time=0.31;
1028+SELECT 1;
1029+1
1030+1
1031+SET SESSION query_exec_time=0.32;
1032+SELECT 1;
1033+1
1034+1
1035+SET SESSION query_exec_time=0.33;
1036+SELECT 1;
1037+1
1038+1
1039+SET SESSION query_exec_time=0.34;
1040+SELECT 1;
1041+1
1042+1
1043+SET SESSION query_exec_time=0.35;
1044+SELECT 1;
1045+1
1046+1
1047+SET SESSION query_exec_time=0.36;
1048+SELECT 1;
1049+1
1050+1
1051+SET SESSION query_exec_time=0.37;
1052+SELECT 1;
1053+1
1054+1
1055+SET SESSION query_exec_time=0.38;
1056+SELECT 1;
1057+1
1058+1
1059+SET SESSION query_exec_time=0.39;
1060+SELECT 1;
1061+1
1062+1
1063+SET SESSION query_exec_time=0.4;
1064+SELECT 1;
1065+1
1066+1
1067+SET SESSION query_exec_time=1.1;
1068+SELECT 1;
1069+1
1070+1
1071+SET SESSION query_exec_time=1.2;
1072+SELECT 1;
1073+1
1074+1
1075+SET SESSION query_exec_time=1.3;
1076+SELECT 1;
1077+1
1078+1
1079+SET SESSION query_exec_time=1.5;
1080+SELECT 1;
1081+1
1082+1
1083+SET SESSION query_exec_time=1.4;
1084+SELECT 1;
1085+1
1086+1
1087+SET SESSION query_exec_time=0.5;
1088+SELECT 1;
1089+1
1090+1
1091+SET SESSION query_exec_time=2.1;
1092+SELECT 1;
1093+1
1094+1
1095+SET SESSION query_exec_time=2.3;
1096+SELECT 1;
1097+1
1098+1
1099+SET SESSION query_exec_time=2.5;
1100+SELECT 1;
1101+1
1102+1
1103+SET SESSION query_exec_time=3.1;
1104+SELECT 1;
1105+1
1106+1
1107+SET SESSION query_exec_time=4.1;
1108+SELECT 1;
1109+1
1110+1
1111+SET SESSION query_exec_time=5.1;
1112+SELECT 1;
1113+1
1114+1
1115+SET SESSION query_exec_time=0.1;
1116+SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
1117+SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
1118+Variable_name Value
1119+query_response_time_range_base 2
1120+SHOW QUERY_RESPONSE_TIME;
1121+
734d6226 1122+ 0.000001 24 0.000000
48b678b4
AM
1123+ 0.000003 0 0.000000
1124+ 0.000007 0 0.000000
1125+ 0.000015 0 0.000000
1126+ 0.000030 0 0.000000
1127+ 0.000061 0 0.000000
1128+ 0.000122 0 0.000000
1129+ 0.000244 0 0.000000
1130+ 0.000488 0 0.000000
1131+ 0.000976 0 0.000000
1132+ 0.001953 0 0.000000
1133+ 0.003906 0 0.000000
1134+ 0.007812 0 0.000000
1135+ 0.015625 0 0.000000
1136+ 0.031250 0 0.000000
1137+ 0.062500 0 0.000000
734d6226 1138+ 0.125000 0 0.000000
48b678b4
AM
1139+ 0.250000 0 0.000000
1140+ 0.500000 10 3.550000
1141+ 1.000000 1 0.500000
1142+ 2.000000 5 6.500000
1143+ 4.000000 4 10.000000
1144+ 8.000000 2 9.199999
1145+ 16.000000 0 0.000000
1146+ 32.000000 0 0.000000
1147+ 64.000000 0 0.000000
1148+ 128.000000 0 0.000000
1149+ 256.000000 0 0.000000
1150+ 512.000000 0 0.000000
1151+ 1024.000000 0 0.000000
1152+ 2048.000000 0 0.000000
1153+ 4096.000000 0 0.000000
1154+ 8192.000000 0 0.000000
1155+ 16384.000000 0 0.000000
1156+ 32768.000000 0 0.000000
1157+ 65536.000000 0 0.000000
1158+ 131072.000000 0 0.000000
1159+ 262144.000000 0 0.000000
1160+ 524288.000000 0 0.000000
9dd04cbc
AM
1161+1048576.000000 0 0.000000
1162+2097152.000000 0 0.000000
1163+4194304.000000 0 0.000000
1164+8388608.000000 0 0.000000
48b678b4
AM
1165+TOO LONG 0 TOO LONG
1166+SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
1167+time count total
734d6226 1168+ 0.000001 24 0.000000
48b678b4
AM
1169+ 0.000003 0 0.000000
1170+ 0.000007 0 0.000000
1171+ 0.000015 0 0.000000
1172+ 0.000030 0 0.000000
1173+ 0.000061 0 0.000000
1174+ 0.000122 0 0.000000
1175+ 0.000244 0 0.000000
1176+ 0.000488 0 0.000000
1177+ 0.000976 0 0.000000
1178+ 0.001953 0 0.000000
1179+ 0.003906 0 0.000000
1180+ 0.007812 0 0.000000
1181+ 0.015625 0 0.000000
1182+ 0.031250 0 0.000000
1183+ 0.062500 0 0.000000
734d6226 1184+ 0.125000 0 0.000000
48b678b4
AM
1185+ 0.250000 0 0.000000
1186+ 0.500000 10 3.550000
1187+ 1.000000 1 0.500000
1188+ 2.000000 5 6.500000
1189+ 4.000000 4 10.000000
1190+ 8.000000 2 9.199999
1191+ 16.000000 0 0.000000
1192+ 32.000000 0 0.000000
1193+ 64.000000 0 0.000000
1194+ 128.000000 0 0.000000
1195+ 256.000000 0 0.000000
1196+ 512.000000 0 0.000000
1197+ 1024.000000 0 0.000000
1198+ 2048.000000 0 0.000000
1199+ 4096.000000 0 0.000000
1200+ 8192.000000 0 0.000000
1201+ 16384.000000 0 0.000000
1202+ 32768.000000 0 0.000000
1203+ 65536.000000 0 0.000000
1204+ 131072.000000 0 0.000000
1205+ 262144.000000 0 0.000000
1206+ 524288.000000 0 0.000000
9dd04cbc
AM
1207+1048576.000000 0 0.000000
1208+2097152.000000 0 0.000000
1209+4194304.000000 0 0.000000
1210+8388608.000000 0 0.000000
48b678b4
AM
1211+TOO LONG 0 TOO LONG
1212+SET SESSION query_exec_time=default;
1213+SET SESSION query_exec_time=0.1;
1214+SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
1215+SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=2;
1216+FLUSH QUERY_RESPONSE_TIME;
734d6226
AM
1217+SHOW QUERY_RESPONSE_TIME;
1218+
1219+ 0.000001 0 0.000000
1220+ 0.000003 0 0.000000
1221+ 0.000007 0 0.000000
1222+ 0.000015 0 0.000000
1223+ 0.000030 0 0.000000
1224+ 0.000061 0 0.000000
1225+ 0.000122 0 0.000000
1226+ 0.000244 0 0.000000
1227+ 0.000488 0 0.000000
1228+ 0.000976 0 0.000000
1229+ 0.001953 0 0.000000
1230+ 0.003906 0 0.000000
1231+ 0.007812 0 0.000000
1232+ 0.015625 0 0.000000
1233+ 0.031250 0 0.000000
1234+ 0.062500 0 0.000000
1235+ 0.125000 0 0.000000
1236+ 0.250000 0 0.000000
1237+ 0.500000 0 0.000000
1238+ 1.000000 0 0.000000
1239+ 2.000000 0 0.000000
1240+ 4.000000 0 0.000000
1241+ 8.000000 0 0.000000
1242+ 16.000000 0 0.000000
1243+ 32.000000 0 0.000000
1244+ 64.000000 0 0.000000
1245+ 128.000000 0 0.000000
1246+ 256.000000 0 0.000000
1247+ 512.000000 0 0.000000
1248+ 1024.000000 0 0.000000
1249+ 2048.000000 0 0.000000
1250+ 4096.000000 0 0.000000
1251+ 8192.000000 0 0.000000
1252+ 16384.000000 0 0.000000
1253+ 32768.000000 0 0.000000
1254+ 65536.000000 0 0.000000
1255+ 131072.000000 0 0.000000
1256+ 262144.000000 0 0.000000
1257+ 524288.000000 0 0.000000
9dd04cbc
AM
1258+1048576.000000 0 0.000000
1259+2097152.000000 0 0.000000
1260+4194304.000000 0 0.000000
1261+8388608.000000 0 0.000000
734d6226
AM
1262+TOO LONG 0 TOO LONG
1263+SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
1264+time count total
1265+ 0.000001 0 0.000000
1266+ 0.000003 0 0.000000
1267+ 0.000007 0 0.000000
1268+ 0.000015 0 0.000000
1269+ 0.000030 0 0.000000
1270+ 0.000061 0 0.000000
1271+ 0.000122 0 0.000000
1272+ 0.000244 0 0.000000
1273+ 0.000488 0 0.000000
1274+ 0.000976 0 0.000000
1275+ 0.001953 0 0.000000
1276+ 0.003906 0 0.000000
1277+ 0.007812 0 0.000000
1278+ 0.015625 0 0.000000
1279+ 0.031250 0 0.000000
1280+ 0.062500 0 0.000000
1281+ 0.125000 0 0.000000
1282+ 0.250000 0 0.000000
1283+ 0.500000 0 0.000000
1284+ 1.000000 0 0.000000
1285+ 2.000000 0 0.000000
1286+ 4.000000 0 0.000000
1287+ 8.000000 0 0.000000
1288+ 16.000000 0 0.000000
1289+ 32.000000 0 0.000000
1290+ 64.000000 0 0.000000
1291+ 128.000000 0 0.000000
1292+ 256.000000 0 0.000000
1293+ 512.000000 0 0.000000
1294+ 1024.000000 0 0.000000
1295+ 2048.000000 0 0.000000
1296+ 4096.000000 0 0.000000
1297+ 8192.000000 0 0.000000
1298+ 16384.000000 0 0.000000
1299+ 32768.000000 0 0.000000
1300+ 65536.000000 0 0.000000
1301+ 131072.000000 0 0.000000
1302+ 262144.000000 0 0.000000
1303+ 524288.000000 0 0.000000
9dd04cbc
AM
1304+1048576.000000 0 0.000000
1305+2097152.000000 0 0.000000
1306+4194304.000000 0 0.000000
1307+8388608.000000 0 0.000000
734d6226 1308+TOO LONG 0 TOO LONG
48b678b4
AM
1309+SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
1310+SET SESSION query_exec_time=0.31;
1311+SELECT 1;
1312+1
1313+1
1314+SET SESSION query_exec_time=0.32;
1315+SELECT 1;
1316+1
1317+1
1318+SET SESSION query_exec_time=0.33;
1319+SELECT 1;
1320+1
1321+1
1322+SET SESSION query_exec_time=0.34;
1323+SELECT 1;
1324+1
1325+1
1326+SET SESSION query_exec_time=0.35;
1327+SELECT 1;
1328+1
1329+1
1330+SET SESSION query_exec_time=0.36;
1331+SELECT 1;
1332+1
1333+1
1334+SET SESSION query_exec_time=0.37;
1335+SELECT 1;
1336+1
1337+1
1338+SET SESSION query_exec_time=0.38;
1339+SELECT 1;
1340+1
1341+1
1342+SET SESSION query_exec_time=0.39;
1343+SELECT 1;
1344+1
1345+1
1346+SET SESSION query_exec_time=0.4;
1347+SELECT 1;
1348+1
1349+1
1350+SET SESSION query_exec_time=1.1;
1351+SELECT 1;
1352+1
1353+1
1354+SET SESSION query_exec_time=1.2;
1355+SELECT 1;
1356+1
1357+1
1358+SET SESSION query_exec_time=1.3;
1359+SELECT 1;
1360+1
1361+1
1362+SET SESSION query_exec_time=1.5;
1363+SELECT 1;
1364+1
1365+1
1366+SET SESSION query_exec_time=1.4;
1367+SELECT 1;
1368+1
1369+1
1370+SET SESSION query_exec_time=0.5;
1371+SELECT 1;
1372+1
1373+1
1374+SET SESSION query_exec_time=2.1;
1375+SELECT 1;
1376+1
1377+1
1378+SET SESSION query_exec_time=2.3;
1379+SELECT 1;
1380+1
1381+1
1382+SET SESSION query_exec_time=2.5;
1383+SELECT 1;
1384+1
1385+1
1386+SET SESSION query_exec_time=3.1;
1387+SELECT 1;
1388+1
1389+1
1390+SET SESSION query_exec_time=4.1;
1391+SELECT 1;
1392+1
1393+1
1394+SET SESSION query_exec_time=5.1;
1395+SELECT 1;
1396+1
1397+1
1398+SET SESSION query_exec_time=0.1;
1399+SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
1400+SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
1401+Variable_name Value
1402+query_response_time_range_base 2
1403+SHOW QUERY_RESPONSE_TIME;
1404+
734d6226 1405+ 0.000001 24 0.000000
48b678b4
AM
1406+ 0.000003 0 0.000000
1407+ 0.000007 0 0.000000
1408+ 0.000015 0 0.000000
1409+ 0.000030 0 0.000000
1410+ 0.000061 0 0.000000
1411+ 0.000122 0 0.000000
1412+ 0.000244 0 0.000000
1413+ 0.000488 0 0.000000
1414+ 0.000976 0 0.000000
1415+ 0.001953 0 0.000000
1416+ 0.003906 0 0.000000
1417+ 0.007812 0 0.000000
1418+ 0.015625 0 0.000000
1419+ 0.031250 0 0.000000
1420+ 0.062500 0 0.000000
734d6226 1421+ 0.125000 0 0.000000
48b678b4
AM
1422+ 0.250000 0 0.000000
1423+ 0.500000 10 3.550000
1424+ 1.000000 1 0.500000
1425+ 2.000000 5 6.500000
1426+ 4.000000 4 10.000000
1427+ 8.000000 2 9.199999
1428+ 16.000000 0 0.000000
1429+ 32.000000 0 0.000000
1430+ 64.000000 0 0.000000
1431+ 128.000000 0 0.000000
1432+ 256.000000 0 0.000000
1433+ 512.000000 0 0.000000
1434+ 1024.000000 0 0.000000
1435+ 2048.000000 0 0.000000
1436+ 4096.000000 0 0.000000
1437+ 8192.000000 0 0.000000
1438+ 16384.000000 0 0.000000
1439+ 32768.000000 0 0.000000
1440+ 65536.000000 0 0.000000
1441+ 131072.000000 0 0.000000
1442+ 262144.000000 0 0.000000
1443+ 524288.000000 0 0.000000
9dd04cbc
AM
1444+1048576.000000 0 0.000000
1445+2097152.000000 0 0.000000
1446+4194304.000000 0 0.000000
1447+8388608.000000 0 0.000000
48b678b4
AM
1448+TOO LONG 0 TOO LONG
1449+SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
1450+time count total
734d6226 1451+ 0.000001 24 0.000000
48b678b4
AM
1452+ 0.000003 0 0.000000
1453+ 0.000007 0 0.000000
1454+ 0.000015 0 0.000000
1455+ 0.000030 0 0.000000
1456+ 0.000061 0 0.000000
1457+ 0.000122 0 0.000000
1458+ 0.000244 0 0.000000
1459+ 0.000488 0 0.000000
1460+ 0.000976 0 0.000000
1461+ 0.001953 0 0.000000
1462+ 0.003906 0 0.000000
1463+ 0.007812 0 0.000000
1464+ 0.015625 0 0.000000
1465+ 0.031250 0 0.000000
1466+ 0.062500 0 0.000000
734d6226 1467+ 0.125000 0 0.000000
48b678b4
AM
1468+ 0.250000 0 0.000000
1469+ 0.500000 10 3.550000
1470+ 1.000000 1 0.500000
1471+ 2.000000 5 6.500000
1472+ 4.000000 4 10.000000
1473+ 8.000000 2 9.199999
1474+ 16.000000 0 0.000000
1475+ 32.000000 0 0.000000
1476+ 64.000000 0 0.000000
1477+ 128.000000 0 0.000000
1478+ 256.000000 0 0.000000
1479+ 512.000000 0 0.000000
1480+ 1024.000000 0 0.000000
1481+ 2048.000000 0 0.000000
1482+ 4096.000000 0 0.000000
1483+ 8192.000000 0 0.000000
1484+ 16384.000000 0 0.000000
1485+ 32768.000000 0 0.000000
1486+ 65536.000000 0 0.000000
1487+ 131072.000000 0 0.000000
1488+ 262144.000000 0 0.000000
1489+ 524288.000000 0 0.000000
9dd04cbc
AM
1490+1048576.000000 0 0.000000
1491+2097152.000000 0 0.000000
1492+4194304.000000 0 0.000000
1493+8388608.000000 0 0.000000
48b678b4
AM
1494+TOO LONG 0 TOO LONG
1495+SET SESSION query_exec_time=default;
1496+SET SESSION query_exec_time=0.1;
1497+SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
1498+SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=10;
1499+FLUSH QUERY_RESPONSE_TIME;
734d6226
AM
1500+SHOW QUERY_RESPONSE_TIME;
1501+
1502+ 0.000001 0 0.000000
1503+ 0.000010 0 0.000000
1504+ 0.000100 0 0.000000
1505+ 0.001000 0 0.000000
1506+ 0.010000 0 0.000000
1507+ 0.100000 0 0.000000
1508+ 1.000000 0 0.000000
1509+ 10.000000 0 0.000000
1510+ 100.000000 0 0.000000
1511+ 1000.000000 0 0.000000
1512+ 10000.000000 0 0.000000
1513+ 100000.000000 0 0.000000
9dd04cbc 1514+1000000.000000 0 0.000000
734d6226
AM
1515+TOO LONG 0 TOO LONG
1516+SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
1517+time count total
1518+ 0.000001 0 0.000000
1519+ 0.000010 0 0.000000
1520+ 0.000100 0 0.000000
1521+ 0.001000 0 0.000000
1522+ 0.010000 0 0.000000
1523+ 0.100000 0 0.000000
1524+ 1.000000 0 0.000000
1525+ 10.000000 0 0.000000
1526+ 100.000000 0 0.000000
1527+ 1000.000000 0 0.000000
1528+ 10000.000000 0 0.000000
1529+ 100000.000000 0 0.000000
9dd04cbc 1530+1000000.000000 0 0.000000
734d6226 1531+TOO LONG 0 TOO LONG
48b678b4
AM
1532+SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
1533+SET SESSION query_exec_time=0.31;
1534+SELECT 1;
1535+1
1536+1
1537+SET SESSION query_exec_time=0.32;
1538+SELECT 1;
1539+1
1540+1
1541+SET SESSION query_exec_time=0.33;
1542+SELECT 1;
1543+1
1544+1
1545+SET SESSION query_exec_time=0.34;
1546+SELECT 1;
1547+1
1548+1
1549+SET SESSION query_exec_time=0.35;
1550+SELECT 1;
1551+1
1552+1
1553+SET SESSION query_exec_time=0.36;
1554+SELECT 1;
1555+1
1556+1
1557+SET SESSION query_exec_time=0.37;
1558+SELECT 1;
1559+1
1560+1
1561+SET SESSION query_exec_time=0.38;
1562+SELECT 1;
1563+1
1564+1
1565+SET SESSION query_exec_time=0.39;
1566+SELECT 1;
1567+1
1568+1
1569+SET SESSION query_exec_time=0.4;
1570+SELECT 1;
1571+1
1572+1
1573+SET SESSION query_exec_time=1.1;
1574+SELECT 1;
1575+1
1576+1
1577+SET SESSION query_exec_time=1.2;
1578+SELECT 1;
1579+1
1580+1
1581+SET SESSION query_exec_time=1.3;
1582+SELECT 1;
1583+1
1584+1
1585+SET SESSION query_exec_time=1.5;
1586+SELECT 1;
1587+1
1588+1
1589+SET SESSION query_exec_time=1.4;
1590+SELECT 1;
1591+1
1592+1
1593+SET SESSION query_exec_time=0.5;
1594+SELECT 1;
1595+1
1596+1
1597+SET SESSION query_exec_time=2.1;
1598+SELECT 1;
1599+1
1600+1
1601+SET SESSION query_exec_time=2.3;
1602+SELECT 1;
1603+1
1604+1
1605+SET SESSION query_exec_time=2.5;
1606+SELECT 1;
1607+1
1608+1
1609+SET SESSION query_exec_time=3.1;
1610+SELECT 1;
1611+1
1612+1
1613+SET SESSION query_exec_time=4.1;
1614+SELECT 1;
1615+1
1616+1
1617+SET SESSION query_exec_time=5.1;
1618+SELECT 1;
1619+1
1620+1
1621+SET SESSION query_exec_time=0.1;
1622+SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
1623+SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
1624+Variable_name Value
1625+query_response_time_range_base 10
1626+SHOW QUERY_RESPONSE_TIME;
1627+
734d6226 1628+ 0.000001 24 0.000000
48b678b4
AM
1629+ 0.000010 0 0.000000
1630+ 0.000100 0 0.000000
1631+ 0.001000 0 0.000000
1632+ 0.010000 0 0.000000
1633+ 0.100000 0 0.000000
734d6226 1634+ 1.000000 11 4.050000
48b678b4
AM
1635+ 10.000000 11 25.699999
1636+ 100.000000 0 0.000000
1637+ 1000.000000 0 0.000000
1638+ 10000.000000 0 0.000000
1639+ 100000.000000 0 0.000000
9dd04cbc 1640+1000000.000000 0 0.000000
48b678b4
AM
1641+TOO LONG 0 TOO LONG
1642+SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
1643+time count total
734d6226 1644+ 0.000001 24 0.000000
48b678b4
AM
1645+ 0.000010 0 0.000000
1646+ 0.000100 0 0.000000
1647+ 0.001000 0 0.000000
1648+ 0.010000 0 0.000000
1649+ 0.100000 0 0.000000
734d6226 1650+ 1.000000 11 4.050000
48b678b4
AM
1651+ 10.000000 11 25.699999
1652+ 100.000000 0 0.000000
1653+ 1000.000000 0 0.000000
1654+ 10000.000000 0 0.000000
1655+ 100000.000000 0 0.000000
9dd04cbc 1656+1000000.000000 0 0.000000
48b678b4
AM
1657+TOO LONG 0 TOO LONG
1658+SET SESSION query_exec_time=default;
1659+SET SESSION query_exec_time=0.1;
1660+SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
1661+SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=7;
1662+FLUSH QUERY_RESPONSE_TIME;
734d6226
AM
1663+SHOW QUERY_RESPONSE_TIME;
1664+
1665+ 0.000001 0 0.000000
1666+ 0.000008 0 0.000000
1667+ 0.000059 0 0.000000
1668+ 0.000416 0 0.000000
1669+ 0.002915 0 0.000000
1670+ 0.020408 0 0.000000
1671+ 0.142857 0 0.000000
1672+ 1.000000 0 0.000000
1673+ 7.000000 0 0.000000
1674+ 49.000000 0 0.000000
1675+ 343.000000 0 0.000000
1676+ 2401.000000 0 0.000000
1677+ 16807.000000 0 0.000000
1678+ 117649.000000 0 0.000000
1679+ 823543.000000 0 0.000000
9dd04cbc 1680+5764801.000000 0 0.000000
734d6226
AM
1681+TOO LONG 0 TOO LONG
1682+SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
1683+time count total
1684+ 0.000001 0 0.000000
1685+ 0.000008 0 0.000000
1686+ 0.000059 0 0.000000
1687+ 0.000416 0 0.000000
1688+ 0.002915 0 0.000000
1689+ 0.020408 0 0.000000
1690+ 0.142857 0 0.000000
1691+ 1.000000 0 0.000000
1692+ 7.000000 0 0.000000
1693+ 49.000000 0 0.000000
1694+ 343.000000 0 0.000000
1695+ 2401.000000 0 0.000000
1696+ 16807.000000 0 0.000000
1697+ 117649.000000 0 0.000000
1698+ 823543.000000 0 0.000000
9dd04cbc 1699+5764801.000000 0 0.000000
734d6226 1700+TOO LONG 0 TOO LONG
48b678b4
AM
1701+SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
1702+SET SESSION query_exec_time=0.31;
1703+SELECT 1;
1704+1
1705+1
1706+SET SESSION query_exec_time=0.32;
1707+SELECT 1;
1708+1
1709+1
1710+SET SESSION query_exec_time=0.33;
1711+SELECT 1;
1712+1
1713+1
1714+SET SESSION query_exec_time=0.34;
1715+SELECT 1;
1716+1
1717+1
1718+SET SESSION query_exec_time=0.35;
1719+SELECT 1;
1720+1
1721+1
1722+SET SESSION query_exec_time=0.36;
1723+SELECT 1;
1724+1
1725+1
1726+SET SESSION query_exec_time=0.37;
1727+SELECT 1;
1728+1
1729+1
1730+SET SESSION query_exec_time=0.38;
1731+SELECT 1;
1732+1
1733+1
1734+SET SESSION query_exec_time=0.39;
1735+SELECT 1;
1736+1
1737+1
1738+SET SESSION query_exec_time=0.4;
1739+SELECT 1;
1740+1
1741+1
1742+SET SESSION query_exec_time=1.1;
1743+SELECT 1;
1744+1
1745+1
1746+SET SESSION query_exec_time=1.2;
1747+SELECT 1;
1748+1
1749+1
1750+SET SESSION query_exec_time=1.3;
1751+SELECT 1;
1752+1
1753+1
1754+SET SESSION query_exec_time=1.5;
1755+SELECT 1;
1756+1
1757+1
1758+SET SESSION query_exec_time=1.4;
1759+SELECT 1;
1760+1
1761+1
1762+SET SESSION query_exec_time=0.5;
1763+SELECT 1;
1764+1
1765+1
1766+SET SESSION query_exec_time=2.1;
1767+SELECT 1;
1768+1
1769+1
1770+SET SESSION query_exec_time=2.3;
1771+SELECT 1;
1772+1
1773+1
1774+SET SESSION query_exec_time=2.5;
1775+SELECT 1;
1776+1
1777+1
1778+SET SESSION query_exec_time=3.1;
1779+SELECT 1;
1780+1
1781+1
1782+SET SESSION query_exec_time=4.1;
1783+SELECT 1;
1784+1
1785+1
1786+SET SESSION query_exec_time=5.1;
1787+SELECT 1;
1788+1
1789+1
1790+SET SESSION query_exec_time=0.1;
1791+SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
1792+SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
1793+Variable_name Value
1794+query_response_time_range_base 7
1795+SHOW QUERY_RESPONSE_TIME;
1796+
734d6226 1797+ 0.000001 24 0.000000
48b678b4
AM
1798+ 0.000008 0 0.000000
1799+ 0.000059 0 0.000000
1800+ 0.000416 0 0.000000
1801+ 0.002915 0 0.000000
1802+ 0.020408 0 0.000000
734d6226 1803+ 0.142857 0 0.000000
48b678b4
AM
1804+ 1.000000 11 4.050000
1805+ 7.000000 11 25.699999
1806+ 49.000000 0 0.000000
1807+ 343.000000 0 0.000000
1808+ 2401.000000 0 0.000000
1809+ 16807.000000 0 0.000000
1810+ 117649.000000 0 0.000000
1811+ 823543.000000 0 0.000000
9dd04cbc 1812+5764801.000000 0 0.000000
48b678b4
AM
1813+TOO LONG 0 TOO LONG
1814+SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
1815+time count total
734d6226 1816+ 0.000001 24 0.000000
48b678b4
AM
1817+ 0.000008 0 0.000000
1818+ 0.000059 0 0.000000
1819+ 0.000416 0 0.000000
1820+ 0.002915 0 0.000000
1821+ 0.020408 0 0.000000
734d6226 1822+ 0.142857 0 0.000000
48b678b4
AM
1823+ 1.000000 11 4.050000
1824+ 7.000000 11 25.699999
1825+ 49.000000 0 0.000000
1826+ 343.000000 0 0.000000
1827+ 2401.000000 0 0.000000
1828+ 16807.000000 0 0.000000
1829+ 117649.000000 0 0.000000
1830+ 823543.000000 0 0.000000
9dd04cbc 1831+5764801.000000 0 0.000000
48b678b4
AM
1832+TOO LONG 0 TOO LONG
1833+SET SESSION query_exec_time=default;
1834+SET SESSION query_exec_time=0.1;
1835+SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
1836+SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=156;
1837+FLUSH QUERY_RESPONSE_TIME;
734d6226
AM
1838+SHOW QUERY_RESPONSE_TIME;
1839+
1840+ 0.000041 0 0.000000
1841+ 0.006410 0 0.000000
1842+ 1.000000 0 0.000000
1843+ 156.000000 0 0.000000
1844+ 24336.000000 0 0.000000
9dd04cbc 1845+3796416.000000 0 0.000000
734d6226
AM
1846+TOO LONG 0 TOO LONG
1847+SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
1848+time count total
1849+ 0.000041 0 0.000000
1850+ 0.006410 0 0.000000
1851+ 1.000000 0 0.000000
1852+ 156.000000 0 0.000000
1853+ 24336.000000 0 0.000000
9dd04cbc 1854+3796416.000000 0 0.000000
734d6226 1855+TOO LONG 0 TOO LONG
48b678b4
AM
1856+SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
1857+SET SESSION query_exec_time=0.31;
1858+SELECT 1;
1859+1
1860+1
1861+SET SESSION query_exec_time=0.32;
1862+SELECT 1;
1863+1
1864+1
1865+SET SESSION query_exec_time=0.33;
1866+SELECT 1;
1867+1
1868+1
1869+SET SESSION query_exec_time=0.34;
1870+SELECT 1;
1871+1
1872+1
1873+SET SESSION query_exec_time=0.35;
1874+SELECT 1;
1875+1
1876+1
1877+SET SESSION query_exec_time=0.36;
1878+SELECT 1;
1879+1
1880+1
1881+SET SESSION query_exec_time=0.37;
1882+SELECT 1;
1883+1
1884+1
1885+SET SESSION query_exec_time=0.38;
1886+SELECT 1;
1887+1
1888+1
1889+SET SESSION query_exec_time=0.39;
1890+SELECT 1;
1891+1
1892+1
1893+SET SESSION query_exec_time=0.4;
1894+SELECT 1;
1895+1
1896+1
1897+SET SESSION query_exec_time=1.1;
1898+SELECT 1;
1899+1
1900+1
1901+SET SESSION query_exec_time=1.2;
1902+SELECT 1;
1903+1
1904+1
1905+SET SESSION query_exec_time=1.3;
1906+SELECT 1;
1907+1
1908+1
1909+SET SESSION query_exec_time=1.5;
1910+SELECT 1;
1911+1
1912+1
1913+SET SESSION query_exec_time=1.4;
1914+SELECT 1;
1915+1
1916+1
1917+SET SESSION query_exec_time=0.5;
1918+SELECT 1;
1919+1
1920+1
1921+SET SESSION query_exec_time=2.1;
1922+SELECT 1;
1923+1
1924+1
1925+SET SESSION query_exec_time=2.3;
1926+SELECT 1;
1927+1
1928+1
1929+SET SESSION query_exec_time=2.5;
1930+SELECT 1;
1931+1
1932+1
1933+SET SESSION query_exec_time=3.1;
1934+SELECT 1;
1935+1
1936+1
1937+SET SESSION query_exec_time=4.1;
1938+SELECT 1;
1939+1
1940+1
1941+SET SESSION query_exec_time=5.1;
1942+SELECT 1;
1943+1
1944+1
1945+SET SESSION query_exec_time=0.1;
1946+SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
1947+SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
1948+Variable_name Value
1949+query_response_time_range_base 156
1950+SHOW QUERY_RESPONSE_TIME;
1951+
734d6226 1952+ 0.000041 24 0.000000
48b678b4 1953+ 0.006410 0 0.000000
734d6226 1954+ 1.000000 11 4.050000
48b678b4
AM
1955+ 156.000000 11 25.699999
1956+ 24336.000000 0 0.000000
9dd04cbc 1957+3796416.000000 0 0.000000
48b678b4
AM
1958+TOO LONG 0 TOO LONG
1959+SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
1960+time count total
734d6226 1961+ 0.000041 24 0.000000
48b678b4 1962+ 0.006410 0 0.000000
734d6226 1963+ 1.000000 11 4.050000
48b678b4
AM
1964+ 156.000000 11 25.699999
1965+ 24336.000000 0 0.000000
9dd04cbc 1966+3796416.000000 0 0.000000
48b678b4
AM
1967+TOO LONG 0 TOO LONG
1968+SET SESSION query_exec_time=default;
1969+SET SESSION query_exec_time=0.1;
1970+SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
1971+SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=1000;
1972+FLUSH QUERY_RESPONSE_TIME;
734d6226
AM
1973+SHOW QUERY_RESPONSE_TIME;
1974+
1975+ 0.000001 0 0.000000
1976+ 0.001000 0 0.000000
1977+ 1.000000 0 0.000000
1978+ 1000.000000 0 0.000000
9dd04cbc 1979+1000000.000000 0 0.000000
734d6226
AM
1980+TOO LONG 0 TOO LONG
1981+SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
1982+time count total
1983+ 0.000001 0 0.000000
1984+ 0.001000 0 0.000000
1985+ 1.000000 0 0.000000
1986+ 1000.000000 0 0.000000
9dd04cbc 1987+1000000.000000 0 0.000000
734d6226 1988+TOO LONG 0 TOO LONG
48b678b4
AM
1989+SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
1990+SET SESSION query_exec_time=0.31;
1991+SELECT 1;
1992+1
1993+1
1994+SET SESSION query_exec_time=0.32;
1995+SELECT 1;
1996+1
1997+1
1998+SET SESSION query_exec_time=0.33;
1999+SELECT 1;
2000+1
2001+1
2002+SET SESSION query_exec_time=0.34;
2003+SELECT 1;
2004+1
2005+1
2006+SET SESSION query_exec_time=0.35;
2007+SELECT 1;
2008+1
2009+1
2010+SET SESSION query_exec_time=0.36;
2011+SELECT 1;
2012+1
2013+1
2014+SET SESSION query_exec_time=0.37;
2015+SELECT 1;
2016+1
2017+1
2018+SET SESSION query_exec_time=0.38;
2019+SELECT 1;
2020+1
2021+1
2022+SET SESSION query_exec_time=0.39;
2023+SELECT 1;
2024+1
2025+1
2026+SET SESSION query_exec_time=0.4;
2027+SELECT 1;
2028+1
2029+1
2030+SET SESSION query_exec_time=1.1;
2031+SELECT 1;
2032+1
2033+1
2034+SET SESSION query_exec_time=1.2;
2035+SELECT 1;
2036+1
2037+1
2038+SET SESSION query_exec_time=1.3;
2039+SELECT 1;
2040+1
2041+1
2042+SET SESSION query_exec_time=1.5;
2043+SELECT 1;
2044+1
2045+1
2046+SET SESSION query_exec_time=1.4;
2047+SELECT 1;
2048+1
2049+1
2050+SET SESSION query_exec_time=0.5;
2051+SELECT 1;
2052+1
2053+1
2054+SET SESSION query_exec_time=2.1;
2055+SELECT 1;
2056+1
2057+1
2058+SET SESSION query_exec_time=2.3;
2059+SELECT 1;
2060+1
2061+1
2062+SET SESSION query_exec_time=2.5;
2063+SELECT 1;
2064+1
2065+1
2066+SET SESSION query_exec_time=3.1;
2067+SELECT 1;
2068+1
2069+1
2070+SET SESSION query_exec_time=4.1;
2071+SELECT 1;
2072+1
2073+1
2074+SET SESSION query_exec_time=5.1;
2075+SELECT 1;
2076+1
2077+1
2078+SET SESSION query_exec_time=0.1;
2079+SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
2080+SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
2081+Variable_name Value
2082+query_response_time_range_base 1000
2083+SHOW QUERY_RESPONSE_TIME;
2084+
734d6226 2085+ 0.000001 24 0.000000
48b678b4 2086+ 0.001000 0 0.000000
734d6226 2087+ 1.000000 11 4.050000
48b678b4 2088+ 1000.000000 11 25.699999
9dd04cbc 2089+1000000.000000 0 0.000000
48b678b4
AM
2090+TOO LONG 0 TOO LONG
2091+SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
2092+time count total
734d6226 2093+ 0.000001 24 0.000000
48b678b4 2094+ 0.001000 0 0.000000
734d6226 2095+ 1.000000 11 4.050000
48b678b4 2096+ 1000.000000 11 25.699999
9dd04cbc 2097+1000000.000000 0 0.000000
48b678b4
AM
2098+TOO LONG 0 TOO LONG
2099+SET SESSION query_exec_time=default;
2100+SET SESSION query_exec_time=0.1;
2101+SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
2102+SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=1001;
2103+Warnings:
2104+Warning 1292 Truncated incorrect query_response_time_range_base value: '1001'
2105+FLUSH QUERY_RESPONSE_TIME;
734d6226
AM
2106+SHOW QUERY_RESPONSE_TIME;
2107+
2108+ 0.000001 0 0.000000
2109+ 0.001000 0 0.000000
2110+ 1.000000 0 0.000000
2111+ 1000.000000 0 0.000000
9dd04cbc 2112+1000000.000000 0 0.000000
734d6226
AM
2113+TOO LONG 0 TOO LONG
2114+SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
2115+time count total
2116+ 0.000001 0 0.000000
2117+ 0.001000 0 0.000000
2118+ 1.000000 0 0.000000
2119+ 1000.000000 0 0.000000
9dd04cbc 2120+1000000.000000 0 0.000000
734d6226 2121+TOO LONG 0 TOO LONG
48b678b4
AM
2122+SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
2123+SET SESSION query_exec_time=0.31;
2124+SELECT 1;
2125+1
2126+1
2127+SET SESSION query_exec_time=0.32;
2128+SELECT 1;
2129+1
2130+1
2131+SET SESSION query_exec_time=0.33;
2132+SELECT 1;
2133+1
2134+1
2135+SET SESSION query_exec_time=0.34;
2136+SELECT 1;
2137+1
2138+1
2139+SET SESSION query_exec_time=0.35;
2140+SELECT 1;
2141+1
2142+1
2143+SET SESSION query_exec_time=0.36;
2144+SELECT 1;
2145+1
2146+1
2147+SET SESSION query_exec_time=0.37;
2148+SELECT 1;
2149+1
2150+1
2151+SET SESSION query_exec_time=0.38;
2152+SELECT 1;
2153+1
2154+1
2155+SET SESSION query_exec_time=0.39;
2156+SELECT 1;
2157+1
2158+1
2159+SET SESSION query_exec_time=0.4;
2160+SELECT 1;
2161+1
2162+1
2163+SET SESSION query_exec_time=1.1;
2164+SELECT 1;
2165+1
2166+1
2167+SET SESSION query_exec_time=1.2;
2168+SELECT 1;
2169+1
2170+1
2171+SET SESSION query_exec_time=1.3;
2172+SELECT 1;
2173+1
2174+1
2175+SET SESSION query_exec_time=1.5;
2176+SELECT 1;
2177+1
2178+1
2179+SET SESSION query_exec_time=1.4;
2180+SELECT 1;
2181+1
2182+1
2183+SET SESSION query_exec_time=0.5;
2184+SELECT 1;
2185+1
2186+1
2187+SET SESSION query_exec_time=2.1;
2188+SELECT 1;
2189+1
2190+1
2191+SET SESSION query_exec_time=2.3;
2192+SELECT 1;
2193+1
2194+1
2195+SET SESSION query_exec_time=2.5;
2196+SELECT 1;
2197+1
2198+1
2199+SET SESSION query_exec_time=3.1;
2200+SELECT 1;
2201+1
2202+1
2203+SET SESSION query_exec_time=4.1;
2204+SELECT 1;
2205+1
2206+1
2207+SET SESSION query_exec_time=5.1;
2208+SELECT 1;
2209+1
2210+1
2211+SET SESSION query_exec_time=0.1;
2212+SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
2213+SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
2214+Variable_name Value
2215+query_response_time_range_base 1000
2216+SHOW QUERY_RESPONSE_TIME;
2217+
734d6226 2218+ 0.000001 24 0.000000
48b678b4 2219+ 0.001000 0 0.000000
734d6226 2220+ 1.000000 11 4.050000
48b678b4 2221+ 1000.000000 11 25.699999
9dd04cbc 2222+1000000.000000 0 0.000000
48b678b4
AM
2223+TOO LONG 0 TOO LONG
2224+SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
2225+time count total
734d6226 2226+ 0.000001 24 0.000000
48b678b4 2227+ 0.001000 0 0.000000
734d6226 2228+ 1.000000 11 4.050000
48b678b4 2229+ 1000.000000 11 25.699999
9dd04cbc 2230+1000000.000000 0 0.000000
48b678b4
AM
2231+TOO LONG 0 TOO LONG
2232+SET SESSION query_exec_time=default;
2233+SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=default;
2234+SET GLOBAL QUERY_RESPONSE_TIME_STATS=default;
2235--- /dev/null
2236+++ b/mysql-test/r/percona_query_response_time-stored.result
2237@@ -0,0 +1,544 @@
2238+CREATE TABLE t(a INT);
2239+CREATE PROCEDURE test_f(t DECIMAL(3,2))
2240+BEGIN
2241+SET SESSION query_exec_time=t;
2242+INSERT INTO t VALUES(1);
2243+SET SESSION query_exec_time=0.1;
2244+DELETE FROM t;
2245+END^
2246+SET SESSION query_exec_time=0.1;
2247+SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
2248+SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=1;
2249+Warnings:
2250+Warning 1292 Truncated incorrect query_response_time_range_base value: '1'
2251+FLUSH QUERY_RESPONSE_TIME;
2252+SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
2253+CALL test_f(0.31);
2254+CALL test_f(0.32);
2255+CALL test_f(0.33);
2256+CALL test_f(0.34);
2257+CALL test_f(0.35);
2258+CALL test_f(0.36);
2259+CALL test_f(0.37);
2260+CALL test_f(0.38);
2261+CALL test_f(0.39);
2262+CALL test_f(0.4);
2263+CALL test_f(1.1);
2264+CALL test_f(1.2);
2265+CALL test_f(1.3);
2266+CALL test_f(1.5);
2267+CALL test_f(1.4);
2268+CALL test_f(0.5);
2269+CALL test_f(2.1);
2270+CALL test_f(2.3);
2271+CALL test_f(2.5);
2272+CALL test_f(3.1);
2273+CALL test_f(4.1);
2274+CALL test_f(5.1);
2275+SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
2276+SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
2277+Variable_name Value
2278+query_response_time_range_base 2
2279+SHOW QUERY_RESPONSE_TIME;
2280+
734d6226 2281+ 0.000001 45 0.000000
48b678b4
AM
2282+ 0.000003 0 0.000000
2283+ 0.000007 0 0.000000
2284+ 0.000015 0 0.000000
2285+ 0.000030 0 0.000000
2286+ 0.000061 0 0.000000
2287+ 0.000122 0 0.000000
2288+ 0.000244 0 0.000000
2289+ 0.000488 0 0.000000
2290+ 0.000976 0 0.000000
2291+ 0.001953 0 0.000000
2292+ 0.003906 0 0.000000
2293+ 0.007812 0 0.000000
2294+ 0.015625 0 0.000000
2295+ 0.031250 0 0.000000
2296+ 0.062500 0 0.000000
734d6226 2297+ 0.125000 44 4.400000
48b678b4
AM
2298+ 0.250000 0 0.000000
2299+ 0.500000 10 3.550000
2300+ 1.000000 1 0.500000
2301+ 2.000000 5 6.500000
2302+ 4.000000 4 10.000000
2303+ 8.000000 2 9.199999
2304+ 16.000000 0 0.000000
2305+ 32.000000 0 0.000000
2306+ 64.000000 0 0.000000
2307+ 128.000000 0 0.000000
2308+ 256.000000 0 0.000000
2309+ 512.000000 0 0.000000
2310+ 1024.000000 0 0.000000
2311+ 2048.000000 0 0.000000
2312+ 4096.000000 0 0.000000
2313+ 8192.000000 0 0.000000
2314+ 16384.000000 0 0.000000
2315+ 32768.000000 0 0.000000
2316+ 65536.000000 0 0.000000
2317+ 131072.000000 0 0.000000
2318+ 262144.000000 0 0.000000
2319+ 524288.000000 0 0.000000
9dd04cbc
AM
2320+1048576.000000 0 0.000000
2321+2097152.000000 0 0.000000
2322+4194304.000000 0 0.000000
2323+8388608.000000 0 0.000000
48b678b4
AM
2324+TOO LONG 0 TOO LONG
2325+SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
2326+time count total
734d6226 2327+ 0.000001 45 0.000000
48b678b4
AM
2328+ 0.000003 0 0.000000
2329+ 0.000007 0 0.000000
2330+ 0.000015 0 0.000000
2331+ 0.000030 0 0.000000
2332+ 0.000061 0 0.000000
2333+ 0.000122 0 0.000000
2334+ 0.000244 0 0.000000
2335+ 0.000488 0 0.000000
2336+ 0.000976 0 0.000000
2337+ 0.001953 0 0.000000
2338+ 0.003906 0 0.000000
2339+ 0.007812 0 0.000000
2340+ 0.015625 0 0.000000
2341+ 0.031250 0 0.000000
2342+ 0.062500 0 0.000000
734d6226 2343+ 0.125000 44 4.400000
48b678b4
AM
2344+ 0.250000 0 0.000000
2345+ 0.500000 10 3.550000
2346+ 1.000000 1 0.500000
2347+ 2.000000 5 6.500000
2348+ 4.000000 4 10.000000
2349+ 8.000000 2 9.199999
2350+ 16.000000 0 0.000000
2351+ 32.000000 0 0.000000
2352+ 64.000000 0 0.000000
2353+ 128.000000 0 0.000000
2354+ 256.000000 0 0.000000
2355+ 512.000000 0 0.000000
2356+ 1024.000000 0 0.000000
2357+ 2048.000000 0 0.000000
2358+ 4096.000000 0 0.000000
2359+ 8192.000000 0 0.000000
2360+ 16384.000000 0 0.000000
2361+ 32768.000000 0 0.000000
2362+ 65536.000000 0 0.000000
2363+ 131072.000000 0 0.000000
2364+ 262144.000000 0 0.000000
2365+ 524288.000000 0 0.000000
9dd04cbc
AM
2366+1048576.000000 0 0.000000
2367+2097152.000000 0 0.000000
2368+4194304.000000 0 0.000000
2369+8388608.000000 0 0.000000
48b678b4
AM
2370+TOO LONG 0 TOO LONG
2371+SET SESSION query_exec_time=default;
2372+SET SESSION query_exec_time=0.1;
2373+SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
2374+SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=2;
2375+FLUSH QUERY_RESPONSE_TIME;
2376+SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
2377+CALL test_f(0.31);
2378+CALL test_f(0.32);
2379+CALL test_f(0.33);
2380+CALL test_f(0.34);
2381+CALL test_f(0.35);
2382+CALL test_f(0.36);
2383+CALL test_f(0.37);
2384+CALL test_f(0.38);
2385+CALL test_f(0.39);
2386+CALL test_f(0.4);
2387+CALL test_f(1.1);
2388+CALL test_f(1.2);
2389+CALL test_f(1.3);
2390+CALL test_f(1.5);
2391+CALL test_f(1.4);
2392+CALL test_f(0.5);
2393+CALL test_f(2.1);
2394+CALL test_f(2.3);
2395+CALL test_f(2.5);
2396+CALL test_f(3.1);
2397+CALL test_f(4.1);
2398+CALL test_f(5.1);
2399+SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
2400+SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
2401+Variable_name Value
2402+query_response_time_range_base 2
2403+SHOW QUERY_RESPONSE_TIME;
2404+
734d6226 2405+ 0.000001 45 0.000000
48b678b4
AM
2406+ 0.000003 0 0.000000
2407+ 0.000007 0 0.000000
2408+ 0.000015 0 0.000000
2409+ 0.000030 0 0.000000
2410+ 0.000061 0 0.000000
2411+ 0.000122 0 0.000000
2412+ 0.000244 0 0.000000
2413+ 0.000488 0 0.000000
2414+ 0.000976 0 0.000000
2415+ 0.001953 0 0.000000
2416+ 0.003906 0 0.000000
2417+ 0.007812 0 0.000000
2418+ 0.015625 0 0.000000
2419+ 0.031250 0 0.000000
2420+ 0.062500 0 0.000000
734d6226 2421+ 0.125000 44 4.400000
48b678b4
AM
2422+ 0.250000 0 0.000000
2423+ 0.500000 10 3.550000
2424+ 1.000000 1 0.500000
2425+ 2.000000 5 6.500000
2426+ 4.000000 4 10.000000
2427+ 8.000000 2 9.199999
2428+ 16.000000 0 0.000000
2429+ 32.000000 0 0.000000
2430+ 64.000000 0 0.000000
2431+ 128.000000 0 0.000000
2432+ 256.000000 0 0.000000
2433+ 512.000000 0 0.000000
2434+ 1024.000000 0 0.000000
2435+ 2048.000000 0 0.000000
2436+ 4096.000000 0 0.000000
2437+ 8192.000000 0 0.000000
2438+ 16384.000000 0 0.000000
2439+ 32768.000000 0 0.000000
2440+ 65536.000000 0 0.000000
2441+ 131072.000000 0 0.000000
2442+ 262144.000000 0 0.000000
2443+ 524288.000000 0 0.000000
9dd04cbc
AM
2444+1048576.000000 0 0.000000
2445+2097152.000000 0 0.000000
2446+4194304.000000 0 0.000000
2447+8388608.000000 0 0.000000
48b678b4
AM
2448+TOO LONG 0 TOO LONG
2449+SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
2450+time count total
734d6226 2451+ 0.000001 45 0.000000
48b678b4
AM
2452+ 0.000003 0 0.000000
2453+ 0.000007 0 0.000000
2454+ 0.000015 0 0.000000
2455+ 0.000030 0 0.000000
2456+ 0.000061 0 0.000000
2457+ 0.000122 0 0.000000
2458+ 0.000244 0 0.000000
2459+ 0.000488 0 0.000000
2460+ 0.000976 0 0.000000
2461+ 0.001953 0 0.000000
2462+ 0.003906 0 0.000000
2463+ 0.007812 0 0.000000
2464+ 0.015625 0 0.000000
2465+ 0.031250 0 0.000000
2466+ 0.062500 0 0.000000
734d6226 2467+ 0.125000 44 4.400000
48b678b4
AM
2468+ 0.250000 0 0.000000
2469+ 0.500000 10 3.550000
2470+ 1.000000 1 0.500000
2471+ 2.000000 5 6.500000
2472+ 4.000000 4 10.000000
2473+ 8.000000 2 9.199999
2474+ 16.000000 0 0.000000
2475+ 32.000000 0 0.000000
2476+ 64.000000 0 0.000000
2477+ 128.000000 0 0.000000
2478+ 256.000000 0 0.000000
2479+ 512.000000 0 0.000000
2480+ 1024.000000 0 0.000000
2481+ 2048.000000 0 0.000000
2482+ 4096.000000 0 0.000000
2483+ 8192.000000 0 0.000000
2484+ 16384.000000 0 0.000000
2485+ 32768.000000 0 0.000000
2486+ 65536.000000 0 0.000000
2487+ 131072.000000 0 0.000000
2488+ 262144.000000 0 0.000000
2489+ 524288.000000 0 0.000000
9dd04cbc
AM
2490+1048576.000000 0 0.000000
2491+2097152.000000 0 0.000000
2492+4194304.000000 0 0.000000
2493+8388608.000000 0 0.000000
48b678b4
AM
2494+TOO LONG 0 TOO LONG
2495+SET SESSION query_exec_time=default;
2496+SET SESSION query_exec_time=0.1;
2497+SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
2498+SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=10;
2499+FLUSH QUERY_RESPONSE_TIME;
2500+SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
2501+CALL test_f(0.31);
2502+CALL test_f(0.32);
2503+CALL test_f(0.33);
2504+CALL test_f(0.34);
2505+CALL test_f(0.35);
2506+CALL test_f(0.36);
2507+CALL test_f(0.37);
2508+CALL test_f(0.38);
2509+CALL test_f(0.39);
2510+CALL test_f(0.4);
2511+CALL test_f(1.1);
2512+CALL test_f(1.2);
2513+CALL test_f(1.3);
2514+CALL test_f(1.5);
2515+CALL test_f(1.4);
2516+CALL test_f(0.5);
2517+CALL test_f(2.1);
2518+CALL test_f(2.3);
2519+CALL test_f(2.5);
2520+CALL test_f(3.1);
2521+CALL test_f(4.1);
2522+CALL test_f(5.1);
2523+SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
2524+SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
2525+Variable_name Value
2526+query_response_time_range_base 10
2527+SHOW QUERY_RESPONSE_TIME;
2528+
734d6226 2529+ 0.000001 45 0.000000
48b678b4
AM
2530+ 0.000010 0 0.000000
2531+ 0.000100 0 0.000000
2532+ 0.001000 0 0.000000
2533+ 0.010000 0 0.000000
2534+ 0.100000 0 0.000000
734d6226 2535+ 1.000000 55 8.450000
48b678b4
AM
2536+ 10.000000 11 25.699999
2537+ 100.000000 0 0.000000
2538+ 1000.000000 0 0.000000
2539+ 10000.000000 0 0.000000
2540+ 100000.000000 0 0.000000
9dd04cbc 2541+1000000.000000 0 0.000000
48b678b4
AM
2542+TOO LONG 0 TOO LONG
2543+SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
2544+time count total
734d6226 2545+ 0.000001 45 0.000000
48b678b4
AM
2546+ 0.000010 0 0.000000
2547+ 0.000100 0 0.000000
2548+ 0.001000 0 0.000000
2549+ 0.010000 0 0.000000
2550+ 0.100000 0 0.000000
734d6226 2551+ 1.000000 55 8.450000
48b678b4
AM
2552+ 10.000000 11 25.699999
2553+ 100.000000 0 0.000000
2554+ 1000.000000 0 0.000000
2555+ 10000.000000 0 0.000000
2556+ 100000.000000 0 0.000000
9dd04cbc 2557+1000000.000000 0 0.000000
48b678b4
AM
2558+TOO LONG 0 TOO LONG
2559+SET SESSION query_exec_time=default;
2560+SET SESSION query_exec_time=0.1;
2561+SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
2562+SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=7;
2563+FLUSH QUERY_RESPONSE_TIME;
2564+SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
2565+CALL test_f(0.31);
2566+CALL test_f(0.32);
2567+CALL test_f(0.33);
2568+CALL test_f(0.34);
2569+CALL test_f(0.35);
2570+CALL test_f(0.36);
2571+CALL test_f(0.37);
2572+CALL test_f(0.38);
2573+CALL test_f(0.39);
2574+CALL test_f(0.4);
2575+CALL test_f(1.1);
2576+CALL test_f(1.2);
2577+CALL test_f(1.3);
2578+CALL test_f(1.5);
2579+CALL test_f(1.4);
2580+CALL test_f(0.5);
2581+CALL test_f(2.1);
2582+CALL test_f(2.3);
2583+CALL test_f(2.5);
2584+CALL test_f(3.1);
2585+CALL test_f(4.1);
2586+CALL test_f(5.1);
2587+SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
2588+SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
2589+Variable_name Value
2590+query_response_time_range_base 7
2591+SHOW QUERY_RESPONSE_TIME;
2592+
734d6226 2593+ 0.000001 45 0.000000
48b678b4
AM
2594+ 0.000008 0 0.000000
2595+ 0.000059 0 0.000000
2596+ 0.000416 0 0.000000
2597+ 0.002915 0 0.000000
2598+ 0.020408 0 0.000000
734d6226 2599+ 0.142857 44 4.400000
48b678b4
AM
2600+ 1.000000 11 4.050000
2601+ 7.000000 11 25.699999
2602+ 49.000000 0 0.000000
2603+ 343.000000 0 0.000000
2604+ 2401.000000 0 0.000000
2605+ 16807.000000 0 0.000000
2606+ 117649.000000 0 0.000000
2607+ 823543.000000 0 0.000000
9dd04cbc 2608+5764801.000000 0 0.000000
48b678b4
AM
2609+TOO LONG 0 TOO LONG
2610+SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
2611+time count total
734d6226 2612+ 0.000001 45 0.000000
48b678b4
AM
2613+ 0.000008 0 0.000000
2614+ 0.000059 0 0.000000
2615+ 0.000416 0 0.000000
2616+ 0.002915 0 0.000000
2617+ 0.020408 0 0.000000
734d6226 2618+ 0.142857 44 4.400000
48b678b4
AM
2619+ 1.000000 11 4.050000
2620+ 7.000000 11 25.699999
2621+ 49.000000 0 0.000000
2622+ 343.000000 0 0.000000
2623+ 2401.000000 0 0.000000
2624+ 16807.000000 0 0.000000
2625+ 117649.000000 0 0.000000
2626+ 823543.000000 0 0.000000
9dd04cbc 2627+5764801.000000 0 0.000000
48b678b4
AM
2628+TOO LONG 0 TOO LONG
2629+SET SESSION query_exec_time=default;
2630+SET SESSION query_exec_time=0.1;
2631+SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
2632+SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=156;
2633+FLUSH QUERY_RESPONSE_TIME;
2634+SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
2635+CALL test_f(0.31);
2636+CALL test_f(0.32);
2637+CALL test_f(0.33);
2638+CALL test_f(0.34);
2639+CALL test_f(0.35);
2640+CALL test_f(0.36);
2641+CALL test_f(0.37);
2642+CALL test_f(0.38);
2643+CALL test_f(0.39);
2644+CALL test_f(0.4);
2645+CALL test_f(1.1);
2646+CALL test_f(1.2);
2647+CALL test_f(1.3);
2648+CALL test_f(1.5);
2649+CALL test_f(1.4);
2650+CALL test_f(0.5);
2651+CALL test_f(2.1);
2652+CALL test_f(2.3);
2653+CALL test_f(2.5);
2654+CALL test_f(3.1);
2655+CALL test_f(4.1);
2656+CALL test_f(5.1);
2657+SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
2658+SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
2659+Variable_name Value
2660+query_response_time_range_base 156
2661+SHOW QUERY_RESPONSE_TIME;
2662+
734d6226 2663+ 0.000041 45 0.000000
48b678b4 2664+ 0.006410 0 0.000000
734d6226 2665+ 1.000000 55 8.450000
48b678b4
AM
2666+ 156.000000 11 25.699999
2667+ 24336.000000 0 0.000000
9dd04cbc 2668+3796416.000000 0 0.000000
48b678b4
AM
2669+TOO LONG 0 TOO LONG
2670+SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
2671+time count total
734d6226 2672+ 0.000041 45 0.000000
48b678b4 2673+ 0.006410 0 0.000000
734d6226 2674+ 1.000000 55 8.450000
48b678b4
AM
2675+ 156.000000 11 25.699999
2676+ 24336.000000 0 0.000000
9dd04cbc 2677+3796416.000000 0 0.000000
48b678b4
AM
2678+TOO LONG 0 TOO LONG
2679+SET SESSION query_exec_time=default;
2680+SET SESSION query_exec_time=0.1;
2681+SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
2682+SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=1000;
2683+FLUSH QUERY_RESPONSE_TIME;
2684+SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
2685+CALL test_f(0.31);
2686+CALL test_f(0.32);
2687+CALL test_f(0.33);
2688+CALL test_f(0.34);
2689+CALL test_f(0.35);
2690+CALL test_f(0.36);
2691+CALL test_f(0.37);
2692+CALL test_f(0.38);
2693+CALL test_f(0.39);
2694+CALL test_f(0.4);
2695+CALL test_f(1.1);
2696+CALL test_f(1.2);
2697+CALL test_f(1.3);
2698+CALL test_f(1.5);
2699+CALL test_f(1.4);
2700+CALL test_f(0.5);
2701+CALL test_f(2.1);
2702+CALL test_f(2.3);
2703+CALL test_f(2.5);
2704+CALL test_f(3.1);
2705+CALL test_f(4.1);
2706+CALL test_f(5.1);
2707+SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
2708+SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
2709+Variable_name Value
2710+query_response_time_range_base 1000
2711+SHOW QUERY_RESPONSE_TIME;
2712+
734d6226 2713+ 0.000001 45 0.000000
48b678b4 2714+ 0.001000 0 0.000000
734d6226 2715+ 1.000000 55 8.450000
48b678b4 2716+ 1000.000000 11 25.699999
9dd04cbc 2717+1000000.000000 0 0.000000
48b678b4
AM
2718+TOO LONG 0 TOO LONG
2719+SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
2720+time count total
734d6226 2721+ 0.000001 45 0.000000
48b678b4 2722+ 0.001000 0 0.000000
734d6226 2723+ 1.000000 55 8.450000
48b678b4 2724+ 1000.000000 11 25.699999
9dd04cbc 2725+1000000.000000 0 0.000000
48b678b4
AM
2726+TOO LONG 0 TOO LONG
2727+SET SESSION query_exec_time=default;
2728+SET SESSION query_exec_time=0.1;
2729+SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
2730+SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=1001;
2731+Warnings:
2732+Warning 1292 Truncated incorrect query_response_time_range_base value: '1001'
2733+FLUSH QUERY_RESPONSE_TIME;
2734+SET GLOBAL QUERY_RESPONSE_TIME_STATS=1;
2735+CALL test_f(0.31);
2736+CALL test_f(0.32);
2737+CALL test_f(0.33);
2738+CALL test_f(0.34);
2739+CALL test_f(0.35);
2740+CALL test_f(0.36);
2741+CALL test_f(0.37);
2742+CALL test_f(0.38);
2743+CALL test_f(0.39);
2744+CALL test_f(0.4);
2745+CALL test_f(1.1);
2746+CALL test_f(1.2);
2747+CALL test_f(1.3);
2748+CALL test_f(1.5);
2749+CALL test_f(1.4);
2750+CALL test_f(0.5);
2751+CALL test_f(2.1);
2752+CALL test_f(2.3);
2753+CALL test_f(2.5);
2754+CALL test_f(3.1);
2755+CALL test_f(4.1);
2756+CALL test_f(5.1);
2757+SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
2758+SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
2759+Variable_name Value
2760+query_response_time_range_base 1000
2761+SHOW QUERY_RESPONSE_TIME;
2762+
734d6226 2763+ 0.000001 45 0.000000
48b678b4 2764+ 0.001000 0 0.000000
734d6226 2765+ 1.000000 55 8.450000
48b678b4 2766+ 1000.000000 11 25.699999
9dd04cbc 2767+1000000.000000 0 0.000000
48b678b4
AM
2768+TOO LONG 0 TOO LONG
2769+SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
2770+time count total
734d6226 2771+ 0.000001 45 0.000000
48b678b4 2772+ 0.001000 0 0.000000
734d6226 2773+ 1.000000 55 8.450000
48b678b4 2774+ 1000.000000 11 25.699999
9dd04cbc 2775+1000000.000000 0 0.000000
48b678b4
AM
2776+TOO LONG 0 TOO LONG
2777+SET SESSION query_exec_time=default;
2778+SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=default;
2779+SET GLOBAL QUERY_RESPONSE_TIME_STATS=default;
2780+DROP PROCEDURE test_f;
2781+DROP TABLE t;
2782--- /dev/null
2783+++ b/mysql-test/t/percona_query_response_time-replication.test
2784@@ -0,0 +1,28 @@
2785+SET GLOBAL query_exec_time=0.1;
2786+
2787+--source include/have_response_time_distribution.inc
2788+--source include/have_debug.inc
2789+--source include/have_binlog_format_statement.inc
2790+--source include/master-slave.inc
2791+
2792+--let base=1
2793+--source include/query_response_time-replication.inc
2794+--let base=2
2795+--source include/query_response_time-replication.inc
2796+--let base=10
2797+--source include/query_response_time-replication.inc
2798+--let base=7
2799+--source include/query_response_time-replication.inc
2800+--let base=156
2801+--source include/query_response_time-replication.inc
2802+--let base=1000
2803+--source include/query_response_time-replication.inc
2804+--let base=1001
2805+--source include/query_response_time-replication.inc
2806+
2807+--source include/rpl_end.inc
2808+
2809+SET GLOBAL query_exec_time=default;
2810+
2811+connection slave;
2812+SET GLOBAL query_exec_time=default;
2813--- /dev/null
2814+++ b/mysql-test/t/percona_query_response_time-stored.test
2815@@ -0,0 +1,36 @@
2816+--source include/have_response_time_distribution.inc
2817+--source include/have_debug.inc
2818+
2819+CREATE TABLE t(a INT);
2820+
2821+delimiter ^;
2822+CREATE PROCEDURE test_f(t DECIMAL(3,2))
2823+BEGIN
2824+ SET SESSION query_exec_time=t;
2825+ INSERT INTO t VALUES(1);
2826+ SET SESSION query_exec_time=0.1;
2827+ DELETE FROM t;
2828+END^
2829+delimiter ;^
2830+
2831+--let base=1
2832+--source include/query_response_time-stored.inc
2833+--let base=2
2834+--source include/query_response_time-stored.inc
2835+--let base=10
2836+--source include/query_response_time-stored.inc
2837+--let base=7
2838+--source include/query_response_time-stored.inc
2839+--let base=156
2840+--source include/query_response_time-stored.inc
2841+--let base=1000
2842+--source include/query_response_time-stored.inc
2843+--let base=1001
2844+--source include/query_response_time-stored.inc
2845+
2846+SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=default;
2847+SET GLOBAL QUERY_RESPONSE_TIME_STATS=default;
2848+
2849+DROP PROCEDURE test_f;
2850+
2851+DROP TABLE t;
2852--- /dev/null
2853+++ b/mysql-test/t/percona_query_response_time.test
2854@@ -0,0 +1,20 @@
2855+--source include/have_response_time_distribution.inc
2856+--source include/have_debug.inc
2857+
2858+--let base=1
2859+--source include/query_response_time.inc
2860+--let base=2
2861+--source include/query_response_time.inc
2862+--let base=10
2863+--source include/query_response_time.inc
2864+--let base=7
2865+--source include/query_response_time.inc
2866+--let base=156
2867+--source include/query_response_time.inc
2868+--let base=1000
2869+--source include/query_response_time.inc
2870+--let base=1001
2871+--source include/query_response_time.inc
2872+
2873+SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=default;
2874+SET GLOBAL QUERY_RESPONSE_TIME_STATS=default;
2875--- /dev/null
db82db79 2876+++ b/patch_info/response-time-distribution.info
b4e1fa2c
AM
2877@@ -0,0 +1,9 @@
2878+File=response-time-distribution.patch
2879+Name=Response time distribution
2880+Version=1.0
2881+Author=Percona <info@percona.com>
2882+License=GPL
2883+Comment=
2884+Changelog
2885+2010-07-02 first version avaliable
2886+2010-09-15 add column 'total'
db82db79
AM
2887--- a/sql/CMakeLists.txt
2888+++ b/sql/CMakeLists.txt
29ffd636 2889@@ -52,7 +52,7 @@
b4e1fa2c
AM
2890 message.h mf_iocache.cc my_decimal.cc ../sql-common/my_time.c
2891 mysqld.cc net_serv.cc keycaches.cc
2892 ../sql-common/client_plugin.c
2893- opt_range.cc opt_range.h opt_sum.cc
2894+ opt_range.cc opt_range.h query_response_time.h opt_sum.cc
2895 ../sql-common/pack.c parse_file.cc password.c procedure.cc
2896 protocol.cc records.cc repl_failsafe.cc rpl_filter.cc set_var.cc
2897 slave.cc sp.cc sp_cache.cc sp_head.cc sp_pcontext.cc
29ffd636 2898@@ -60,7 +60,7 @@
b4e1fa2c
AM
2899 sql_cache.cc sql_class.cc sql_client.cc sql_crypt.cc sql_crypt.h
2900 sql_cursor.cc sql_db.cc sql_delete.cc sql_derived.cc sql_do.cc
2901 sql_error.cc sql_handler.cc sql_help.cc sql_insert.cc sql_lex.cc
2902- sql_list.cc sql_load.cc sql_manager.cc sql_parse.cc
2903+ sql_list.cc sql_load.cc sql_manager.cc sql_parse.cc query_response_time.cc
2904 sql_partition.cc sql_plugin.cc sql_prepare.cc sql_rename.cc
2905 debug_sync.cc debug_sync.h
2906 sql_repl.cc sql_select.cc sql_show.cc sql_state.c sql_string.cc
db82db79
AM
2907--- a/sql/handler.h
2908+++ b/sql/handler.h
2909@@ -581,6 +581,7 @@
b4e1fa2c
AM
2910 SCH_PROFILES,
2911 SCH_REFERENTIAL_CONSTRAINTS,
2912 SCH_PROCEDURES,
2913+ SCH_QUERY_RESPONSE_TIME,
2914 SCH_SCHEMATA,
2915 SCH_SCHEMA_PRIVILEGES,
2916 SCH_SESSION_STATUS,
db82db79
AM
2917--- a/sql/lex.h
2918+++ b/sql/lex.h
b4e1fa2c
AM
2919@@ -426,6 +426,7 @@
2920 { "PURGE", SYM(PURGE)},
2921 { "QUARTER", SYM(QUARTER_SYM)},
2922 { "QUERY", SYM(QUERY_SYM)},
2923+ { "QUERY_RESPONSE_TIME", SYM(QUERY_RESPONSE_TIME_SYM)},
2924 { "QUICK", SYM(QUICK)},
2925 { "RANGE", SYM(RANGE_SYM)},
2926 { "READ", SYM(READ_SYM)},
db82db79
AM
2927--- a/sql/mysqld.cc
2928+++ b/sql/mysqld.cc
b4e1fa2c
AM
2929@@ -69,6 +69,8 @@
2930 #include "debug_sync.h"
2931 #include "sql_callback.h"
2932
2933+#include "query_response_time.h"
2934+
2935 #ifdef WITH_PERFSCHEMA_STORAGE_ENGINE
2936 #include "../storage/perfschema/pfs_server.h"
2937 #endif /* WITH_PERFSCHEMA_STORAGE_ENGINE */
29ffd636 2938@@ -615,7 +617,7 @@
b4e1fa2c
AM
2939 MY_LOCALE *my_default_lc_messages;
2940 MY_LOCALE *my_default_lc_time_names;
2941
2942-SHOW_COMP_OPTION have_ssl, have_symlink, have_dlopen, have_query_cache;
2943+SHOW_COMP_OPTION have_ssl, have_symlink, have_dlopen, have_query_cache, have_response_time_distribution;
2944 SHOW_COMP_OPTION have_geometry, have_rtree_keys;
2945 SHOW_COMP_OPTION have_crypt, have_compress;
2946 SHOW_COMP_OPTION have_profiling;
29ffd636 2947@@ -917,6 +919,10 @@
b4e1fa2c
AM
2948 my_bool opt_enable_shared_memory;
2949 HANDLE smem_event_connect_request= 0;
2950 #endif
2951+#ifdef HAVE_RESPONSE_TIME_DISTRIBUTION
2952+ulong opt_query_response_time_range_base = QRT_DEFAULT_BASE;
d8778560 2953+my_bool opt_query_response_time_stats= 0;
b4e1fa2c
AM
2954+#endif // HAVE_RESPONSE_TIME_DISTRIBUTION
2955
2956 my_bool opt_use_ssl = 0;
2957 char *opt_ssl_ca= NULL, *opt_ssl_capath= NULL, *opt_ssl_cert= NULL,
29ffd636 2958@@ -1488,6 +1494,9 @@
b4e1fa2c
AM
2959 my_free(opt_bin_logname);
2960 bitmap_free(&temp_pool);
2961 free_max_user_conn();
2962+#ifdef HAVE_RESPONSE_TIME_DISTRIBUTION
2963+ query_response_time_free();
2964+#endif // HAVE_RESPONSE_TIME_DISTRIBUTION
2965 #ifdef HAVE_REPLICATION
2966 end_slave_list();
2967 #endif
29ffd636 2968@@ -3860,6 +3869,9 @@
b4e1fa2c
AM
2969 if (!DEFAULT_ERRMSGS[0][0])
2970 unireg_abort(1);
2971
2972+#ifdef HAVE_RESPONSE_TIME_DISTRIBUTION
2973+ query_response_time_init();
2974+#endif // HAVE_RESPONSE_TIME_DISTRIBUTION
2975 /* We have to initialize the storage engines before CSV logging */
2976 if (ha_init())
2977 {
29ffd636 2978@@ -6773,6 +6785,11 @@
b4e1fa2c
AM
2979 #else
2980 have_query_cache=SHOW_OPTION_NO;
2981 #endif
2982+#ifdef HAVE_RESPONSE_TIME_DISTRIBUTION
2983+ have_response_time_distribution= SHOW_OPTION_YES;
2984+#else // HAVE_RESPONSE_TIME_DISTRIBUTION
2985+ have_response_time_distribution= SHOW_OPTION_NO;
2986+#endif // HAVE_RESPONSE_TIME_DISTRIBUTION
2987 #ifdef HAVE_SPATIAL
2988 have_geometry=SHOW_OPTION_YES;
2989 #else
db82db79
AM
2990--- a/sql/mysqld.h
2991+++ b/sql/mysqld.h
b4e1fa2c
AM
2992@@ -98,6 +98,10 @@
2993 extern bool opt_disable_networking, opt_skip_show_db;
2994 extern bool opt_skip_name_resolve;
2995 extern bool opt_ignore_builtin_innodb;
2996+#ifdef HAVE_RESPONSE_TIME_DISTRIBUTION
2997+extern ulong opt_query_response_time_range_base;
d8778560 2998+extern my_bool opt_query_response_time_stats;
b4e1fa2c
AM
2999+#endif // HAVE_RESPONSE_TIME_DISTRIBUTION
3000 extern my_bool opt_character_set_client_handshake;
3001 extern bool volatile abort_loop;
3002 extern bool in_bootstrap;
db82db79
AM
3003--- /dev/null
3004+++ b/sql/query_response_time.cc
9dd04cbc 3005@@ -0,0 +1,302 @@
b4e1fa2c 3006+#include "mysql_version.h"
b4e1fa2c
AM
3007+#include "my_global.h"
3008+#ifdef HAVE_RESPONSE_TIME_DISTRIBUTION
3009+#include "mysql_com.h"
3010+#include "rpl_tblmap.h"
3011+#include "table.h"
3012+#include "field.h"
3013+#include "sql_show.h"
3014+#include "query_response_time.h"
3015+
3016+#define TIME_STRING_POSITIVE_POWER_LENGTH QRT_TIME_STRING_POSITIVE_POWER_LENGTH
3017+#define TIME_STRING_NEGATIVE_POWER_LENGTH 6
3018+#define TOTAL_STRING_POSITIVE_POWER_LENGTH QRT_TOTAL_STRING_POSITIVE_POWER_LENGTH
3019+#define TOTAL_STRING_NEGATIVE_POWER_LENGTH 6
3020+#define MINIMUM_BASE 2
3021+#define MAXIMUM_BASE QRT_MAXIMUM_BASE
3022+#define POSITIVE_POWER_FILLER QRT_POSITIVE_POWER_FILLER
3023+#define NEGATIVE_POWER_FILLER QRT_NEGATIVE_POWER_FILLER
b4e1fa2c
AM
3024+#define TIME_OVERFLOW QRT_TIME_OVERFLOW
3025+#define DEFAULT_BASE QRT_DEFAULT_BASE
3026+
3027+#define do_xstr(s) do_str(s)
3028+#define do_str(s) #s
3029+#define do_format(filler,width) "%" filler width "lld"
3030+/*
3031+ Format strings for snprintf. Generate from:
3032+ POSITIVE_POWER_FILLER and TIME_STRING_POSITIVE_POWER_LENGTH
3033+ NEFATIVE_POWER_FILLER and TIME_STRING_NEGATIVE_POWER_LENGTH
3034+*/
3035+#define TIME_STRING_POSITIVE_POWER_FORMAT do_format(POSITIVE_POWER_FILLER,do_xstr(TIME_STRING_POSITIVE_POWER_LENGTH))
3036+#define TIME_STRING_NEGATIVE_POWER_FORMAT do_format(NEGATIVE_POWER_FILLER,do_xstr(TIME_STRING_NEGATIVE_POWER_LENGTH))
3037+#define TIME_STRING_FORMAT TIME_STRING_POSITIVE_POWER_FORMAT "." TIME_STRING_NEGATIVE_POWER_FORMAT
3038+
3039+#define TOTAL_STRING_POSITIVE_POWER_FORMAT do_format(POSITIVE_POWER_FILLER,do_xstr(TOTAL_STRING_POSITIVE_POWER_LENGTH))
3040+#define TOTAL_STRING_NEGATIVE_POWER_FORMAT do_format(NEGATIVE_POWER_FILLER,do_xstr(TOTAL_STRING_NEGATIVE_POWER_LENGTH))
3041+#define TOTAL_STRING_FORMAT TOTAL_STRING_POSITIVE_POWER_FORMAT "." TOTAL_STRING_NEGATIVE_POWER_FORMAT
3042+
3043+#define TIME_STRING_LENGTH QRT_TIME_STRING_LENGTH
3044+#define TIME_STRING_BUFFER_LENGTH (TIME_STRING_LENGTH + 1 /* '\0' */)
3045+
3046+#define TOTAL_STRING_LENGTH QRT_TOTAL_STRING_LENGTH
3047+#define TOTAL_STRING_BUFFER_LENGTH (TOTAL_STRING_LENGTH + 1 /* '\0' */)
3048+
3049+/*
3050+ Calculate length of "log linear"
3051+ 1)
3052+ (MINIMUM_BASE ^ result) <= (10 ^ STRING_POWER_LENGTH) < (MINIMUM_BASE ^ (result + 1))
3053+
3054+ 2)
3055+ (MINIMUM_BASE ^ result) <= (10 ^ STRING_POWER_LENGTH)
3056+ and
3057+ (MINIMUM_BASE ^ (result + 1)) > (10 ^ STRING_POWER_LENGTH)
3058+
3059+ 3)
3060+ result <= LOG(MINIMUM_BASE, 10 ^ STRING_POWER_LENGTH)= STRING_POWER_LENGTH * LOG(MINIMUM_BASE,10)
3061+ result + 1 > LOG(MINIMUM_BASE, 10 ^ STRING_POWER_LENGTH)= STRING_POWER_LENGTH * LOG(MINIMUM_BASE,10)
3062+
3063+ 4) STRING_POWER_LENGTH * LOG(MINIMUM_BASE,10) - 1 < result <= STRING_POWER_LENGTH * LOG(MINIMUM_BASE,10)
3064+
3065+ MINIMUM_BASE= 2 always, LOG(MINIMUM_BASE,10)= 3.3219280948873626, result= (int)3.3219280948873626 * STRING_POWER_LENGTH
3066+
3067+ Last counter always use for time overflow
3068+*/
3069+#define POSITIVE_POWER_COUNT ((int)(3.32192809 * TIME_STRING_POSITIVE_POWER_LENGTH))
3070+#define NEGATIVE_POWER_COUNT ((int)(3.32192809 * TIME_STRING_NEGATIVE_POWER_LENGTH))
3071+#define OVERALL_POWER_COUNT (NEGATIVE_POWER_COUNT + 1 + POSITIVE_POWER_COUNT)
3072+
3073+#define MILLION ((unsigned long)1000 * 1000)
3074+
3075+namespace query_response_time
3076+{
3077+
3078+class utility
3079+{
3080+public:
3081+ utility() : m_base(0)
3082+ {
3083+ m_max_dec_value= MILLION;
3084+ for(int i= 0; TIME_STRING_POSITIVE_POWER_LENGTH > i; ++i)
3085+ m_max_dec_value *= 10;
3086+ setup(DEFAULT_BASE);
3087+ }
3088+public:
3089+ uint base() const { return m_base; }
3090+ uint negative_count() const { return m_negative_count; }
3091+ uint positive_count() const { return m_positive_count; }
3092+ uint bound_count() const { return m_bound_count; }
3093+ ulonglong max_dec_value() const { return m_max_dec_value; }
3094+ ulonglong bound(uint index) const { return m_bound[ index ]; }
3095+public:
3096+ void setup(uint base)
3097+ {
3098+ if(base != m_base)
3099+ {
3100+ m_base= base;
3101+
3102+ const ulonglong million= 1000 * 1000;
3103+ ulonglong value= million;
3104+ m_negative_count= 0;
3105+ while(value > 0)
3106+ {
3107+ m_negative_count += 1;
3108+ value /= m_base;
3109+ }
3110+ m_negative_count -= 1;
3111+
3112+ value= million;
3113+ m_positive_count= 0;
3114+ while(value < m_max_dec_value)
3115+ {
3116+ m_positive_count += 1;
3117+ value *= m_base;
3118+ }
3119+ m_bound_count= m_negative_count + m_positive_count;
3120+
3121+ value= million;
3122+ for(uint i= 0; i < m_negative_count; ++i)
3123+ {
3124+ value /= m_base;
3125+ m_bound[m_negative_count - i - 1]= value;
3126+ }
3127+ value= million;
3128+ for(uint i= 0; i < m_positive_count; ++i)
3129+ {
3130+ m_bound[m_negative_count + i]= value;
3131+ value *= m_base;
3132+ }
3133+ }
3134+ }
3135+private:
3136+ uint m_base;
3137+ uint m_negative_count;
3138+ uint m_positive_count;
3139+ uint m_bound_count;
3140+ ulonglong m_max_dec_value; /* for TIME_STRING_POSITIVE_POWER_LENGTH=7 is 10000000 */
3141+ ulonglong m_bound[OVERALL_POWER_COUNT];
3142+};
3143+
9dd04cbc
AM
3144+static
3145+void print_time(char* buffer, std::size_t buffer_size, const char* format,
3146+ uint64 value)
b4e1fa2c 3147+{
b4e1fa2c
AM
3148+ ulonglong second= (value / MILLION);
3149+ ulonglong microsecond= (value % MILLION);
9dd04cbc 3150+ my_snprintf(buffer, buffer_size, format, second, microsecond);
b4e1fa2c 3151+}
adf0fb13
AM
3152+
3153+class time_collector
b4e1fa2c
AM
3154+{
3155+public:
adf0fb13 3156+ time_collector(utility& u) : m_utility(&u)
b4e1fa2c 3157+ {
adf0fb13 3158+ my_atomic_rwlock_init(&time_collector_lock);
b4e1fa2c 3159+ }
adf0fb13 3160+ ~time_collector()
b4e1fa2c 3161+ {
adf0fb13 3162+ my_atomic_rwlock_destroy(&time_collector_lock);
b4e1fa2c 3163+ }
adf0fb13 3164+ uint32 count(uint index) const
b4e1fa2c 3165+ {
adf0fb13 3166+ my_atomic_rwlock_rdlock(&time_collector_lock);
9dd04cbc 3167+ uint32 result= my_atomic_load32((int32*)&m_count[index]);
adf0fb13
AM
3168+ my_atomic_rwlock_rdunlock(&time_collector_lock);
3169+ return result;
b4e1fa2c 3170+ }
adf0fb13 3171+ uint64 total(uint index) const
b4e1fa2c 3172+ {
adf0fb13 3173+ my_atomic_rwlock_rdlock(&time_collector_lock);
9dd04cbc 3174+ uint64 result= my_atomic_load64((int64*)&m_total[index]);
adf0fb13
AM
3175+ my_atomic_rwlock_rdunlock(&time_collector_lock);
3176+ return result;
b4e1fa2c 3177+ }
b4e1fa2c
AM
3178+public:
3179+ void flush()
3180+ {
adf0fb13
AM
3181+ my_atomic_rwlock_wrlock(&time_collector_lock);
3182+ memset((void*)&m_count,0,sizeof(m_count));
b4e1fa2c 3183+ memset((void*)&m_total,0,sizeof(m_total));
adf0fb13 3184+ my_atomic_rwlock_wrunlock(&time_collector_lock);
b4e1fa2c
AM
3185+ }
3186+ void collect(uint64 time)
3187+ {
b4e1fa2c
AM
3188+ int i= 0;
3189+ for(int count= m_utility->bound_count(); count > i; ++i)
3190+ {
3191+ if(m_utility->bound(i) > time)
3192+ {
adf0fb13 3193+ my_atomic_rwlock_wrlock(&time_collector_lock);
9dd04cbc
AM
3194+ my_atomic_add32((int32*)(&m_count[i]), 1);
3195+ my_atomic_add64((int64*)(&m_total[i]), time);
adf0fb13 3196+ my_atomic_rwlock_wrunlock(&time_collector_lock);
b4e1fa2c
AM
3197+ break;
3198+ }
3199+ }
3200+ }
3201+private:
3202+ utility* m_utility;
adf0fb13
AM
3203+ /* The lock for atomic operations on m_count and m_total. Only actually
3204+ used on architectures that do not have atomic implementation of atomic
3205+ operations. */
3206+ my_atomic_rwlock_t time_collector_lock;
9dd04cbc
AM
3207+ uint32 m_count[OVERALL_POWER_COUNT + 1];
3208+ uint64 m_total[OVERALL_POWER_COUNT + 1];
b4e1fa2c
AM
3209+};
3210+
3211+class collector
3212+{
3213+public:
3214+ collector() : m_time(m_utility)
3215+ {
3216+ m_utility.setup(DEFAULT_BASE);
3217+ m_time.flush();
3218+ }
3219+public:
3220+ void flush()
3221+ {
3222+ m_utility.setup(opt_query_response_time_range_base);
3223+ m_time.flush();
3224+ }
3225+ int fill(THD* thd, TABLE_LIST *tables, COND *cond)
3226+ {
3227+ DBUG_ENTER("fill_schema_query_response_time");
3228+ TABLE *table= static_cast<TABLE*>(tables->table);
3229+ Field **fields= table->field;
3230+ for(uint i= 0, count= bound_count() + 1 /* with overflow */; count > i; ++i)
3231+ {
3232+ char time[TIME_STRING_BUFFER_LENGTH];
3233+ char total[TOTAL_STRING_BUFFER_LENGTH];
3234+ if(i == bound_count())
3235+ {
3236+ assert(sizeof(TIME_OVERFLOW) <= TIME_STRING_BUFFER_LENGTH);
3237+ assert(sizeof(TIME_OVERFLOW) <= TOTAL_STRING_BUFFER_LENGTH);
3238+ memcpy(time,TIME_OVERFLOW,sizeof(TIME_OVERFLOW));
3239+ memcpy(total,TIME_OVERFLOW,sizeof(TIME_OVERFLOW));
3240+ }
3241+ else
3242+ {
9dd04cbc
AM
3243+ print_time(time, sizeof(time), TIME_STRING_FORMAT, this->bound(i));
3244+ print_time(total, sizeof(total), TOTAL_STRING_FORMAT, this->total(i));
b4e1fa2c
AM
3245+ }
3246+ fields[0]->store(time,strlen(time),system_charset_info);
3247+ fields[1]->store(this->count(i));
3248+ fields[2]->store(total,strlen(total),system_charset_info);
3249+ if (schema_table_store_record(thd, table))
3250+ {
3251+ DBUG_RETURN(1);
3252+ }
3253+ }
3254+ DBUG_RETURN(0);
3255+ }
3256+ void collect(ulonglong time)
3257+ {
3258+ m_time.collect(time);
3259+ }
3260+ uint bound_count() const
3261+ {
3262+ return m_utility.bound_count();
3263+ }
3264+ ulonglong bound(uint index)
3265+ {
3266+ return m_utility.bound(index);
3267+ }
3268+ ulonglong count(uint index)
3269+ {
3270+ return m_time.count(index);
3271+ }
3272+ ulonglong total(uint index)
3273+ {
3274+ return m_time.total(index);
3275+ }
3276+private:
3277+ utility m_utility;
3278+ time_collector m_time;
3279+};
3280+
3281+static collector g_collector;
3282+
3283+} // namespace query_response_time
3284+
3285+void query_response_time_init()
3286+{
3287+}
3288+
3289+void query_response_time_free()
3290+{
3291+ query_response_time::g_collector.flush();
3292+}
3293+
3294+void query_response_time_flush()
3295+{
3296+ query_response_time::g_collector.flush();
3297+}
3298+void query_response_time_collect(ulonglong query_time)
3299+{
3300+ query_response_time::g_collector.collect(query_time);
3301+}
3302+
3303+int query_response_time_fill(THD* thd, TABLE_LIST *tables, COND *cond)
3304+{
3305+ return query_response_time::g_collector.fill(thd,tables,cond);
3306+}
3307+#endif // HAVE_RESPONSE_TIME_DISTRIBUTION
db82db79
AM
3308--- /dev/null
3309+++ b/sql/query_response_time.h
9dd04cbc 3310@@ -0,0 +1,64 @@
b4e1fa2c
AM
3311+#ifndef QUERY_RESPONSE_TIME_H
3312+#define QUERY_RESPONSE_TIME_H
3313+
3314+/*
3315+ Settings for query response time
3316+*/
3317+
3318+/*
3319+ Maximum string length for (10 ^ (-1 * QRT_STRING_NEGATIVE_POWER_LENGTH)) in text representation.
3320+ Example: for 6 is 0.000001
3321+ Always 2
3322+
3323+ Maximum string length for (10 ^ (QRT_STRING_POSITIVE_POWER_LENGTH + 1) - 1) in text representation.
3324+ Example: for 7 is 9999999.0
3325+*/
3326+#define QRT_TIME_STRING_POSITIVE_POWER_LENGTH 7
3327+#define QRT_TOTAL_STRING_POSITIVE_POWER_LENGTH 7
3328+
3329+/*
3330+ Minimum base for log - ALWAYS 2
3331+ Maximum base for log:
3332+*/
3333+#define QRT_MAXIMUM_BASE 1000
3334+
3335+/*
3336+ Filler for whole number (positive power)
3337+ Example: for
3338+ QRT_POSITIVE_POWER_FILLER ' '
3339+ QRT_POSITIVE_POWER_LENGTH 7
3340+ and number 7234 result is:
3341+ ' 7234'
3342+*/
9dd04cbc 3343+#define QRT_POSITIVE_POWER_FILLER ""
b4e1fa2c
AM
3344+/*
3345+ Filler for fractional number. Similiary to whole number
3346+*/
3347+#define QRT_NEGATIVE_POWER_FILLER "0"
3348+
3349+/*
b4e1fa2c
AM
3350+ Message if time too big for statistic collecting (very long query)
3351+*/
3352+#define QRT_TIME_OVERFLOW "TOO LONG"
3353+
3354+#define QRT_DEFAULT_BASE 10
3355+
3356+#define QRT_TIME_STRING_LENGTH \
3357+ max( (QRT_TIME_STRING_POSITIVE_POWER_LENGTH + 1 /* '.' */ + 6 /*QRT_TIME_STRING_NEGATIVE_POWER_LENGTH*/), \
9dd04cbc 3358+ (sizeof(QRT_TIME_OVERFLOW) - 1) )
b4e1fa2c
AM
3359+
3360+#define QRT_TOTAL_STRING_LENGTH \
3361+ max( (QRT_TOTAL_STRING_POSITIVE_POWER_LENGTH + 1 /* '.' */ + 6 /*QRT_TOTAL_STRING_NEGATIVE_POWER_LENGTH*/), \
9dd04cbc 3362+ (sizeof(QRT_TIME_OVERFLOW) - 1) )
b4e1fa2c
AM
3363+
3364+extern ST_SCHEMA_TABLE query_response_time_table;
3365+
3366+#ifdef HAVE_RESPONSE_TIME_DISTRIBUTION
3367+extern void query_response_time_init ();
3368+extern void query_response_time_free ();
3369+extern void query_response_time_flush ();
3370+extern void query_response_time_collect(ulonglong query_time);
3371+extern int query_response_time_fill (THD* thd, TABLE_LIST *tables, COND *cond);
3372+#endif // HAVE_RESPONSE_TIME_DISTRIBUTION
3373+
3374+#endif // QUERY_RESPONSE_TIME_H
db82db79
AM
3375--- a/sql/set_var.h
3376+++ b/sql/set_var.h
29ffd636 3377@@ -294,6 +294,7 @@
b4e1fa2c
AM
3378
3379 extern SHOW_COMP_OPTION have_ssl, have_symlink, have_dlopen;
3380 extern SHOW_COMP_OPTION have_query_cache;
3381+extern SHOW_COMP_OPTION have_response_time_distribution;
3382 extern SHOW_COMP_OPTION have_geometry, have_rtree_keys;
3383 extern SHOW_COMP_OPTION have_crypt;
3384 extern SHOW_COMP_OPTION have_compress;
db82db79
AM
3385--- a/sql/sql_parse.cc
3386+++ b/sql/sql_parse.cc
b4e1fa2c
AM
3387@@ -88,6 +88,7 @@
3388 #include "sp_cache.h"
3389 #include "events.h"
3390 #include "sql_trigger.h"
3391+#include "query_response_time.h"
3392 #include "transaction.h"
3393 #include "sql_audit.h"
3394 #include "sql_prepare.h"
13ceb006 3395@@ -1518,6 +1519,12 @@
11822e22 3396
48b678b4
AM
3397 ulonglong end_utime_of_query= thd->current_utime();
3398 ulonglong query_exec_time= get_query_exec_time(thd, end_utime_of_query);
734d6226
AM
3399+#ifdef HAVE_RESPONSE_TIME_DISTRIBUTION
3400+ if (opt_query_response_time_stats)
3401+ {
3402+ query_response_time_collect(query_exec_time);
3403+ }
3404+#endif
48b678b4
AM
3405
3406 /*
3407 Low long_query_time value most likely means user is debugging stuff and even
13ceb006 3408@@ -1682,6 +1689,7 @@
b4e1fa2c
AM
3409 case SCH_CHARSETS:
3410 case SCH_ENGINES:
3411 case SCH_COLLATIONS:
3412+ case SCH_QUERY_RESPONSE_TIME:
3413 case SCH_COLLATION_CHARACTER_SET_APPLICABILITY:
3414 case SCH_USER_PRIVILEGES:
3415 case SCH_SCHEMA_PRIVILEGES:
db82db79
AM
3416--- a/sql/sql_reload.cc
3417+++ b/sql/sql_reload.cc
b4e1fa2c
AM
3418@@ -25,7 +25,7 @@
3419 #include "hostname.h" // hostname_cache_refresh
3420 #include "sql_repl.h" // reset_master, reset_slave
3421 #include "debug_sync.h"
3422-
3423+#include "query_response_time.h"
3424
3425 /**
3426 Reload/resets privileges and the different caches.
13ceb006 3427@@ -322,6 +322,12 @@
b4e1fa2c
AM
3428 #endif
3429 if (options & REFRESH_USER_RESOURCES)
3430 reset_mqh((LEX_USER *) NULL, 0); /* purecov: inspected */
3431+#ifdef HAVE_RESPONSE_TIME_DISTRIBUTION
3432+ if (options & REFRESH_QUERY_RESPONSE_TIME)
3433+ {
3434+ query_response_time_flush();
3435+ }
3436+#endif // HAVE_RESPONSE_TIME_DISTRIBUTION
d8778560
AM
3437 if (*write_to_binlog != -1)
3438 *write_to_binlog= tmp_write_to_binlog;
b4e1fa2c 3439 /*
db82db79
AM
3440--- a/sql/sql_show.cc
3441+++ b/sql/sql_show.cc
b4e1fa2c
AM
3442@@ -50,6 +50,7 @@
3443 #include "event_data_objects.h"
3444 #endif
3445 #include <my_dir.h>
3446+#include "query_response_time.h"
3447 #include "lock.h" // MYSQL_OPEN_IGNORE_FLUSH
3448 #include "debug_sync.h"
3449 #include "datadict.h" // dd_frm_type()
734d6226 3450@@ -7888,6 +7889,14 @@
b4e1fa2c
AM
3451
3452 */
3453
3454+ST_FIELD_INFO query_response_time_fields_info[] =
3455+ {
3456+ {"time", QRT_TIME_STRING_LENGTH, MYSQL_TYPE_STRING, 0, 0, "", SKIP_OPEN_TABLE },
3457+ {"count", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, MY_I_S_UNSIGNED, "", SKIP_OPEN_TABLE },
3458+ {"total", QRT_TIME_STRING_LENGTH, MYSQL_TYPE_STRING, 0, 0, "", SKIP_OPEN_TABLE },
3459+ {0, 0, MYSQL_TYPE_STRING, 0, 0, 0, SKIP_OPEN_TABLE }
3460+ };
3461+
3462 ST_SCHEMA_TABLE schema_tables[]=
3463 {
3464 {"CHARACTER_SETS", charsets_fields_info, create_schema_table,
734d6226 3465@@ -7941,6 +7950,13 @@
b4e1fa2c
AM
3466 1, 9, 0, OPTIMIZE_I_S_TABLE|OPEN_TABLE_ONLY},
3467 {"ROUTINES", proc_fields_info, create_schema_table,
3468 fill_schema_proc, make_proc_old_format, 0, -1, -1, 0, 0},
3469+#ifdef HAVE_RESPONSE_TIME_DISTRIBUTION
3470+ {"QUERY_RESPONSE_TIME", query_response_time_fields_info, create_schema_table,
3471+ query_response_time_fill, make_old_format, 0, -1, -1, 0, 0},
3472+#else
3473+ {"QUERY_RESPONSE_TIME", query_response_time_fields_info, create_schema_table,
3474+ 0, make_old_format, 0, -1, -1, 0, 0},
3475+#endif // HAVE_RESPONSE_TIME_DISTRIBUTION
3476 {"SCHEMATA", schema_fields_info, create_schema_table,
3477 fill_schema_schemata, make_schemata_old_format, 0, 1, -1, 0, 0},
3478 {"SCHEMA_PRIVILEGES", schema_privileges_fields_info, create_schema_table,
db82db79
AM
3479--- a/sql/sql_yacc.yy
3480+++ b/sql/sql_yacc.yy
3481@@ -1194,6 +1194,7 @@
b4e1fa2c
AM
3482 %token PURGE
3483 %token QUARTER_SYM
3484 %token QUERY_SYM
3485+%token QUERY_RESPONSE_TIME_SYM
3486 %token QUICK
3487 %token RANGE_SYM /* SQL-2003-R */
3488 %token READS_SYM /* SQL-2003-R */
29ffd636 3489@@ -11105,6 +11106,15 @@
b4e1fa2c
AM
3490 {
3491 Lex->sql_command = SQLCOM_SHOW_SLAVE_STAT;
3492 }
3493+ | QUERY_RESPONSE_TIME_SYM wild_and_where
3494+ {
3495+#ifdef HAVE_RESPONSE_TIME_DISTRIBUTION
3496+ LEX *lex= Lex;
3497+ lex->sql_command= SQLCOM_SELECT;
3498+ if (prepare_schema_table(YYTHD, lex, 0, SCH_QUERY_RESPONSE_TIME))
3499+ MYSQL_YYABORT;
3500+#endif // HAVE_RESPONSE_TIME_DISTRIBUTION
3501+ }
3502 | CREATE PROCEDURE_SYM sp_name
3503 {
3504 LEX *lex= Lex;
29ffd636 3505@@ -11344,6 +11354,12 @@
734d6226
AM
3506 Lex->type|= REFRESH_SLAVE;
3507 Lex->reset_slave_info.all= false;
3508 }
b4e1fa2c
AM
3509+ | QUERY_RESPONSE_TIME_SYM
3510+ {
3511+#ifdef HAVE_RESPONSE_TIME_DISTRIBUTION
3512+ Lex->type|= REFRESH_QUERY_RESPONSE_TIME;
3513+#endif // HAVE_RESPONSE_TIME_DISTRIBUTION
3514+ }
3515 | MASTER_SYM
3516 { Lex->type|= REFRESH_MASTER; }
3517 | DES_KEY_FILE
29ffd636 3518@@ -12651,6 +12667,7 @@
b4e1fa2c
AM
3519 | PROXY_SYM {}
3520 | QUARTER_SYM {}
3521 | QUERY_SYM {}
3522+ | QUERY_RESPONSE_TIME_SYM {}
3523 | QUICK {}
3524 | READ_ONLY_SYM {}
3525 | REBUILD_SYM {}
db82db79
AM
3526--- a/sql/sys_vars.cc
3527+++ b/sql/sys_vars.cc
29ffd636
AM
3528@@ -51,6 +51,7 @@
3529
3530 TYPELIB bool_typelib={ array_elements(bool_values)-1, "", bool_values, 0 };
b4e1fa2c
AM
3531
3532+#include "query_response_time.h"
3533 /*
3534 This forward declaration is needed because including sql_base.h
3535 causes further includes. [TODO] Eliminate this forward declaration
29ffd636 3536@@ -1939,6 +1940,26 @@
b4e1fa2c
AM
3537 DEFAULT(FALSE));
3538 #endif /* HAVE_QUERY_CACHE */
3539
3540+
3541+static Sys_var_have Sys_have_response_time_distribution(
3542+ "have_response_time_distribution", "have_response_time_distribution",
3543+ READ_ONLY GLOBAL_VAR(have_response_time_distribution), NO_CMD_LINE);
3544+
3545+#ifdef HAVE_RESPONSE_TIME_DISTRIBUTION
d8778560
AM
3546+static Sys_var_mybool Sys_query_response_time_stats(
3547+ "query_response_time_stats", "Enable or disable query response time statisics collecting",
3548+ GLOBAL_VAR(opt_query_response_time_stats), CMD_LINE(OPT_ARG),
b4e1fa2c
AM
3549+ DEFAULT(FALSE));
3550+
3551+static Sys_var_ulong Sys_query_response_time_range_base(
3552+ "query_response_time_range_base",
3553+ "Select base of log for query_response_time ranges. WARNING: variable change affect only after flush",
3554+ GLOBAL_VAR(opt_query_response_time_range_base),
3555+ CMD_LINE(REQUIRED_ARG), VALID_RANGE(2, QRT_MAXIMUM_BASE),
3556+ DEFAULT(QRT_DEFAULT_BASE),
3557+ BLOCK_SIZE(1));
3558+#endif // HAVE_RESPONSE_TIME_DISTRIBUTION
3559+
3560 static Sys_var_mybool Sys_secure_auth(
3561 "secure_auth",
3562 "Disallow authentication for accounts that have old (pre-4.1) "
48b678b4
AM
3563--- /dev/null
3564+++ b/mysql-test/r/have_response_time_distribution.require
3565@@ -0,0 +1,2 @@
3566+Variable_name Value
3567+have_response_time_distribution YES
734d6226
AM
3568--- a/include/atomic/x86-gcc.h
3569+++ b/include/atomic/x86-gcc.h
9dd04cbc 3570@@ -108,27 +108,23 @@
db82db79
AM
3571 v=tmp;
3572
3573 /*
3574- On some platforms (e.g. Mac OS X and Solaris) the ebx register
3575- is held as a pointer to the global offset table. Thus we're not
3576- allowed to use the b-register on those platforms when compiling
3577- PIC code, to avoid this we push ebx and pop ebx. The new value
3578- is copied directly from memory to avoid problems with a implicit
3579- manipulation of the stack pointer by the push.
3580-
3581 cmpxchg8b works on both 32-bit platforms and 64-bit platforms but
3582 the code here is only used on 32-bit platforms, on 64-bit
3583 platforms the much simpler make_atomic_cas_body32 will work
3584 fine.
3585 */
3586-#define make_atomic_cas_body64 \
3587- asm volatile ("push %%ebx;" \
3588- "movl (%%ecx), %%ebx;" \
3589- "movl 4(%%ecx), %%ecx;" \
3590- LOCK_prefix "; cmpxchg8b %0;" \
3591- "setz %2; pop %%ebx" \
3592- : "=m" (*a), "+A" (*cmp), "=c" (ret) \
3593- : "c" (&set), "m" (*a) \
3594- : "memory", "esp")
3595+#define make_atomic_cas_body64 \
9dd04cbc
AM
3596+ asm volatile ("movl %%edi, -4(%%esp);" \
3597+ "leal %0, %%edi;" \
3598+ "xchgl %%ebx, %%esi;" \
3599+ LOCK_prefix "; cmpxchg8b (%%edi);" \
3600+ "movl %%esi, %%ebx;" \
3601+ "movl -4(%%esp), %%edi;" \
3602+ "setz %1;" \
3603+ : "+m" (*a), "=q" (ret), "+A" (*cmp) \
3604+ : "S" ((int32)(set & 0xFFFFFFFF)), \
3605+ "c" ((int32)(set >> 32)) \
3606+ : "memory", "flags")
db82db79
AM
3607 #endif
3608
3609 /*
734d6226
AM
3610--- a/mysql-test/r/mysqld--help-notwin.result
3611+++ b/mysql-test/r/mysqld--help-notwin.result
1bfc1981 3612@@ -505,6 +505,12 @@
734d6226
AM
3613 Invalidate queries in query cache on LOCK for write
3614 --query-prealloc-size=#
3615 Persistent buffer for query parsing and execution
3616+ --query-response-time-range-base=#
3617+ Select base of log for query_response_time ranges.
3618+ WARNING: variable change affect only after flush
3619+ --query-response-time-stats
3620+ Enable or disable query response time statisics
3621+ collecting
3622 --range-alloc-block-size=#
3623 Allocation block size for storing ranges during
3624 optimization
1bfc1981 3625@@ -939,6 +945,8 @@
734d6226
AM
3626 query-cache-type ON
3627 query-cache-wlock-invalidate FALSE
3628 query-prealloc-size 8192
3629+query-response-time-range-base 10
3630+query-response-time-stats FALSE
3631 range-alloc-block-size 4096
3632 read-buffer-size 131072
3633 read-only FALSE
This page took 0.542537 seconds and 4 git commands to generate.