2
Query_ID Duration Query
4
Status Duration CPU_user CPU_system Context_voluntary Context_involuntary Block_ops_in Block_ops_out Messages_sent Messages_received Page_faults_major Page_faults_minor Swaps Source_function Source_file Source_line
5
show session variables like 'profil%';
8
profiling_history_size 15
12
set global profiling = ON;
13
ERROR HY000: Variable 'profiling' is a SESSION variable and can't be used with SET GLOBAL
14
set global profiling_history_size=100;
15
show global variables like 'profil%';
18
profiling_history_size 100
19
set session profiling = ON;
20
set session profiling_history_size=30;
21
show session variables like 'profil%';
24
profiling_history_size 30
32
insert into t1 values (1,1), (2,null), (3, 4);
33
insert into t1 values (5,1), (6,null), (7, 4);
34
insert into t1 values (1,1), (2,null), (3, 4);
35
insert into t1 values (5,1), (6,null), (7, 4);
36
select max(x) from (select sum(a) as x from t1 group by b) as teeone;
39
insert into t1 select * from t1;
40
select count(*) from t1;
43
insert into t1 select * from t1;
44
insert into t1 select * from t1;
45
insert into t1 select * from t1;
46
select count(*) from t1;
49
insert into t1 select * from t1;
50
insert into t1 select * from t1;
51
insert into t1 select * from t1;
52
select count(*) from t1;
55
select sum(a) from t1;
58
select sum(a) from t1 group by b;
63
select sum(a) + sum(b) from t1 group by b;
68
select max(x) from (select sum(a) as x from t1 group by b) as teeone;
71
select '012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890' as big_string;
73
012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890
75
Query_ID Duration Query
76
1 # set session profiling_history_size=30
77
2 # show session variables like 'profil%'
78
3 # select @@profiling
83
5 # insert into t1 values (1,1), (2,null), (3, 4)
84
6 # insert into t1 values (5,1), (6,null), (7, 4)
85
7 # insert into t1 values (1,1), (2,null), (3, 4)
86
8 # insert into t1 values (5,1), (6,null), (7, 4)
87
9 # select max(x) from (select sum(a) as x from t1 group by b) as teeone
88
10 # insert into t1 select * from t1
89
11 # select count(*) from t1
90
12 # insert into t1 select * from t1
91
13 # insert into t1 select * from t1
92
14 # insert into t1 select * from t1
93
15 # select count(*) from t1
94
16 # insert into t1 select * from t1
95
17 # insert into t1 select * from t1
96
18 # insert into t1 select * from t1
97
19 # select count(*) from t1
98
20 # select sum(a) from t1
99
21 # select sum(a) from t1 group by b
100
22 # select sum(a) + sum(b) from t1 group by b
101
23 # select max(x) from (select sum(a) as x from t1 group by b) as teeone
102
24 # select '0123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345
103
show profile for query 15;
104
show profile cpu for query 15;
105
show profile cpu, block io for query 15;
106
show profile cpu for query 9 limit 2 offset 2;
107
show profile cpu for query 10 limit 0;
108
show profile cpu for query 65534;
110
show profile block io;
111
show profile context switches;
112
show profile page faults;
114
show profile swaps limit 1 offset 2;
116
show profile all for query 0 limit 0;
117
show profile all for query 15;
118
select * from information_schema.profiling;
119
select query_id, state, duration from information_schema.profiling;
120
select query_id, sum(duration) from information_schema.profiling group by query_id;
121
select query_id, count(*) from information_schema.profiling group by query_id;
122
select sum(duration) from information_schema.profiling;
123
select query_id, count(*), sum(duration) from information_schema.profiling group by query_id;
124
select CPU_user, CPU_system, Context_voluntary, Context_involuntary, Block_ops_in, Block_ops_out, Messages_sent, Messages_received, Page_faults_major, Page_faults_minor, Swaps, Source_function, Source_file, Source_line from information_schema.profiling;
125
drop table if exists t1, t2, t3;
127
Note 1051 Unknown table 't2'
128
Note 1051 Unknown table 't3'
129
create table t1 (id int );
130
create table t2 (id int not null);
131
create table t3 (id int not null primary key);
132
insert into t1 values (1), (2), (3);
133
insert into t2 values (1), (2), (3);
134
insert into t3 values (1), (2), (3);
136
Query_ID Duration Query
137
10 # insert into t1 select * from t1
138
11 # select count(*) from t1
139
12 # insert into t1 select * from t1
140
13 # insert into t1 select * from t1
141
14 # insert into t1 select * from t1
142
15 # select count(*) from t1
143
16 # insert into t1 select * from t1
144
17 # insert into t1 select * from t1
145
18 # insert into t1 select * from t1
146
19 # select count(*) from t1
147
20 # select sum(a) from t1
148
21 # select sum(a) from t1 group by b
149
22 # select sum(a) + sum(b) from t1 group by b
150
23 # select max(x) from (select sum(a) as x from t1 group by b) as teeone
151
24 # select '0123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345
152
25 # select * from information_schema.profiling
153
26 # select query_id, state, duration from information_schema.profiling
154
27 # select query_id, sum(duration) from information_schema.profiling group by query_id
155
28 # select query_id, count(*) from information_schema.profiling group by query_id
156
29 # select sum(duration) from information_schema.profiling
157
30 # select query_id, count(*), sum(duration) from information_schema.profiling group by query_id
158
31 # select CPU_user, CPU_system, Context_voluntary, Context_involuntary, Block_ops_in, Block_ops_out, Messages_sent, Messages_received, Page_faults_major, Page_faults_minor, Swaps, Source_function, Source_file, Source_line from information_schema.profiling
159
32 # drop table if exists t1, t2, t3
161
34 # create table t1 (id int )
162
35 # create table t2 (id int not null)
163
36 # create table t3 (id int not null primary key)
164
37 # insert into t1 values (1), (2), (3)
165
38 # insert into t2 values (1), (2), (3)
166
39 # insert into t3 values (1), (2), (3)
173
Query_ID Duration Query
174
11 # select count(*) from t1
175
12 # insert into t1 select * from t1
176
13 # insert into t1 select * from t1
177
14 # insert into t1 select * from t1
178
15 # select count(*) from t1
179
16 # insert into t1 select * from t1
180
17 # insert into t1 select * from t1
181
18 # insert into t1 select * from t1
182
19 # select count(*) from t1
183
20 # select sum(a) from t1
184
21 # select sum(a) from t1 group by b
185
22 # select sum(a) + sum(b) from t1 group by b
186
23 # select max(x) from (select sum(a) as x from t1 group by b) as teeone
187
24 # select '0123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345
188
25 # select * from information_schema.profiling
189
26 # select query_id, state, duration from information_schema.profiling
190
27 # select query_id, sum(duration) from information_schema.profiling group by query_id
191
28 # select query_id, count(*) from information_schema.profiling group by query_id
192
29 # select sum(duration) from information_schema.profiling
193
30 # select query_id, count(*), sum(duration) from information_schema.profiling group by query_id
194
31 # select CPU_user, CPU_system, Context_voluntary, Context_involuntary, Block_ops_in, Block_ops_out, Messages_sent, Messages_received, Page_faults_major, Page_faults_minor, Swaps, Source_function, Source_file, Source_line from information_schema.profiling
195
32 # drop table if exists t1, t2, t3
197
34 # create table t1 (id int )
198
35 # create table t2 (id int not null)
199
36 # create table t3 (id int not null primary key)
200
37 # insert into t1 values (1), (2), (3)
201
38 # insert into t2 values (1), (2), (3)
202
39 # insert into t3 values (1), (2), (3)
203
40 # select * from t1
204
This ^^ should end in "select * from t1;"
206
insert into t1 values (1), (2), (3);
207
insert into t1 values (1), (2), (3);
217
Query_ID Duration Query
218
15 # select count(*) from t1
219
16 # insert into t1 select * from t1
220
17 # insert into t1 select * from t1
221
18 # insert into t1 select * from t1
222
19 # select count(*) from t1
223
20 # select sum(a) from t1
224
21 # select sum(a) from t1 group by b
225
22 # select sum(a) + sum(b) from t1 group by b
226
23 # select max(x) from (select sum(a) as x from t1 group by b) as teeone
227
24 # select '0123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345
228
25 # select * from information_schema.profiling
229
26 # select query_id, state, duration from information_schema.profiling
230
27 # select query_id, sum(duration) from information_schema.profiling group by query_id
231
28 # select query_id, count(*) from information_schema.profiling group by query_id
232
29 # select sum(duration) from information_schema.profiling
233
30 # select query_id, count(*), sum(duration) from information_schema.profiling group by query_id
234
31 # select CPU_user, CPU_system, Context_voluntary, Context_involuntary, Block_ops_in, Block_ops_out, Messages_sent, Messages_received, Page_faults_major, Page_faults_minor, Swaps, Source_function, Source_file, Source_line from information_schema.profiling
235
32 # drop table if exists t1, t2, t3
237
34 # create table t1 (id int )
238
35 # create table t2 (id int not null)
239
36 # create table t3 (id int not null primary key)
240
37 # insert into t1 values (1), (2), (3)
241
38 # insert into t2 values (1), (2), (3)
242
39 # insert into t3 values (1), (2), (3)
243
40 # select * from t1
245
42 # insert into t1 values (1), (2), (3)
246
43 # insert into t1 values (1), (2), (3)
247
44 # select * from t1
248
set session profiling = OFF;
249
select sum(id) from t1;
253
Query_ID Duration Query
254
15 # select count(*) from t1
255
16 # insert into t1 select * from t1
256
17 # insert into t1 select * from t1
257
18 # insert into t1 select * from t1
258
19 # select count(*) from t1
259
20 # select sum(a) from t1
260
21 # select sum(a) from t1 group by b
261
22 # select sum(a) + sum(b) from t1 group by b
262
23 # select max(x) from (select sum(a) as x from t1 group by b) as teeone
263
24 # select '0123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345
264
25 # select * from information_schema.profiling
265
26 # select query_id, state, duration from information_schema.profiling
266
27 # select query_id, sum(duration) from information_schema.profiling group by query_id
267
28 # select query_id, count(*) from information_schema.profiling group by query_id
268
29 # select sum(duration) from information_schema.profiling
269
30 # select query_id, count(*), sum(duration) from information_schema.profiling group by query_id
270
31 # select CPU_user, CPU_system, Context_voluntary, Context_involuntary, Block_ops_in, Block_ops_out, Messages_sent, Messages_received, Page_faults_major, Page_faults_minor, Swaps, Source_function, Source_file, Source_line from information_schema.profiling
271
32 # drop table if exists t1, t2, t3
273
34 # create table t1 (id int )
274
35 # create table t2 (id int not null)
275
36 # create table t3 (id int not null primary key)
276
37 # insert into t1 values (1), (2), (3)
277
38 # insert into t2 values (1), (2), (3)
278
39 # insert into t3 values (1), (2), (3)
279
40 # select * from t1
281
42 # insert into t1 values (1), (2), (3)
282
43 # insert into t1 values (1), (2), (3)
283
44 # select * from t1
284
set session profiling = ON;
288
create function f1() returns varchar(50) return 'hello';
292
select * from t1 where id <> f1();
303
set session profiling = OFF;
304
drop table if exists profile_log;
306
Note 1051 Unknown table 'profile_log'
307
create table profile_log (how_many int);
308
drop procedure if exists p1;
309
drop procedure if exists p2;
310
drop procedure if exists p3;
311
create procedure p1 ()
315
select 'This p1 should show up in profiling';
316
insert into profile_log select count(*) from information_schema.profiling;
318
create procedure p2()
323
select 'This p2 should show up in profiling';
325
create procedure p3 ()
329
select 'This p3 should show up in profiling';
334
select * from profile_log;
337
select * from profile_log;
340
select * from profile_log;
341
set session profiling = OFF;
343
set session profiling = OFF;
346
drop procedure if exists p1;
347
drop procedure if exists p2;
348
drop procedure if exists p3;
349
drop table if exists profile_log;
350
set session profiling = ON;
351
drop table if exists t2;
352
create table t2 (id int not null);
353
create trigger t2_bi before insert on t2 for each row set @x=0;
357
insert into t2 values (1), (2), (3);
361
set session profiling = ON;
362
drop table if exists t1, t2;
363
create table t1 (id int not null primary key);
364
create table t2 (id int not null primary key, id1 int not null);
368
alter table t2 add foreign key (id1) references t1 (id) on delete cascade;
381
select @@profiling, @@autocommit;
382
@@profiling @@autocommit
388
insert into t1 values (1);
389
insert into t2 values (1,1);
390
testing referential integrity cascade
391
delete from t1 where id = 1;
409
drop table if exists t1, t2, t3;
410
drop view if exists v1;
412
Note 1051 Unknown table 'test.v1'
413
drop function if exists f1;
414
set session profiling = OFF;