summaryrefslogtreecommitdiff
path: root/mysql-test/main/profiling.result
blob: f4673e62861404dd5ae7e3abdeb271ed4f8139f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
show profiles;
Query_ID	Duration	Query
show profile all;
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
show session variables like 'profil%';
Variable_name	Value
profiling	OFF
profiling_history_size	15
select @@profiling;
@@profiling
0
set @start_value= @@global.profiling_history_size;
set global profiling_history_size=100;
show global variables like 'profil%';
Variable_name	Value
profiling	OFF
profiling_history_size	100
set session profiling = ON;
set session profiling_history_size=30;
show session variables like 'profil%';
Variable_name	Value
profiling	ON
profiling_history_size	30
select @@profiling;
@@profiling
1
create table t1 (
a int,
b int
);
insert into t1 values (1,1), (2,null), (3, 4);
insert into t1 values (5,1), (6,null), (7, 4);
insert into t1 values (1,1), (2,null), (3, 4);
insert into t1 values (5,1), (6,null), (7, 4);
select max(x) from (select sum(a) as x from t1 group by b) as teeone;
max(x)
20
insert into t1 select * from t1;
select count(*) from t1;
count(*)
24
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
select count(*) from t1;
count(*)
192
insert into t1 select * from t1;
insert into t1 select * from t1;
insert into t1 select * from t1;
select count(*) from t1;
count(*)
1536
select sum(a) from t1;
sum(a)
6144
select sum(a) from t1 group by b;
sum(a)
2048
1536
2560
select sum(a) + sum(b) from t1 group by b;
sum(a) + sum(b)
NULL
2048
4608
select max(x) from (select sum(a) as x from t1 group by b) as teeone;
max(x)
2560
select '012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890' as big_string;
big_string
012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890
show profiles;
Query_ID	Duration	Query
1	#	set session profiling_history_size=30
2	#	show session variables like 'profil%'
3	#	select @@profiling
4	#	create table t1 (
a int,
b int
)
5	#	insert into t1 values (1,1), (2,null), (3, 4)
6	#	insert into t1 values (5,1), (6,null), (7, 4)
7	#	insert into t1 values (1,1), (2,null), (3, 4)
8	#	insert into t1 values (5,1), (6,null), (7, 4)
9	#	select max(x) from (select sum(a) as x from t1 group by b) as teeone
10	#	insert into t1 select * from t1
11	#	select count(*) from t1
12	#	insert into t1 select * from t1
13	#	insert into t1 select * from t1
14	#	insert into t1 select * from t1
15	#	select count(*) from t1
16	#	insert into t1 select * from t1
17	#	insert into t1 select * from t1
18	#	insert into t1 select * from t1
19	#	select count(*) from t1
20	#	select sum(a) from t1
21	#	select sum(a) from t1 group by b
22	#	select sum(a) + sum(b) from t1 group by b
23	#	select max(x) from (select sum(a) as x from t1 group by b) as teeone
24	#	select '0123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345
show profile for query 15;
show profile cpu for query 15;
show profile cpu, block io for query 15;
show profile cpu for query 9 limit 2 offset 2;
show profile cpu for query 10 limit 0;
show profile cpu for query 65534;
show profile memory;
show profile block io;
show profile context switches;
show profile page faults;
show profile ipc;
show profile swaps limit 1 offset 2;
show profile source;
show profile all for query 0 limit 0;
show profile all for query 15;
select * from information_schema.profiling;
select query_id, state, duration from information_schema.profiling;
select query_id, sum(duration) from information_schema.profiling group by query_id;
select query_id, count(*) from information_schema.profiling group by query_id;
select sum(duration) from information_schema.profiling;
select query_id, count(*), sum(duration) from information_schema.profiling group by query_id;
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;
drop table if exists t1, t2, t3;
Warnings:
Note	1051	Unknown table 'test.t2,test.t3'
create table t1 (id int );
create table t2 (id int not null);
create table t3 (id int not null primary key);
insert into t1 values (1), (2), (3);
insert into t2 values (1), (2), (3);
insert into t3 values (1), (2), (3);
show profiles;
Query_ID	Duration	Query
10	#	insert into t1 select * from t1
11	#	select count(*) from t1
12	#	insert into t1 select * from t1
13	#	insert into t1 select * from t1
14	#	insert into t1 select * from t1
15	#	select count(*) from t1
16	#	insert into t1 select * from t1
17	#	insert into t1 select * from t1
18	#	insert into t1 select * from t1
19	#	select count(*) from t1
20	#	select sum(a) from t1
21	#	select sum(a) from t1 group by b
22	#	select sum(a) + sum(b) from t1 group by b
23	#	select max(x) from (select sum(a) as x from t1 group by b) as teeone
24	#	select '0123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345
25	#	select * from information_schema.profiling
26	#	select query_id, state, duration from information_schema.profiling
27	#	select query_id, sum(duration) from information_schema.profiling group by query_id
28	#	select query_id, count(*) from information_schema.profiling group by query_id
29	#	select sum(duration) from information_schema.profiling
30	#	select query_id, count(*), sum(duration) from information_schema.profiling group by query_id
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
32	#	drop table if exists t1, t2, t3
33	#	SHOW WARNINGS
34	#	create table t1 (id int )
35	#	create table t2 (id int not null)
36	#	create table t3 (id int not null primary key)
37	#	insert into t1 values (1), (2), (3)
38	#	insert into t2 values (1), (2), (3)
39	#	insert into t3 values (1), (2), (3)
select * from t1;
id
1
2
3
show profiles;
Query_ID	Duration	Query
11	#	select count(*) from t1
12	#	insert into t1 select * from t1
13	#	insert into t1 select * from t1
14	#	insert into t1 select * from t1
15	#	select count(*) from t1
16	#	insert into t1 select * from t1
17	#	insert into t1 select * from t1
18	#	insert into t1 select * from t1
19	#	select count(*) from t1
20	#	select sum(a) from t1
21	#	select sum(a) from t1 group by b
22	#	select sum(a) + sum(b) from t1 group by b
23	#	select max(x) from (select sum(a) as x from t1 group by b) as teeone
24	#	select '0123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345
25	#	select * from information_schema.profiling
26	#	select query_id, state, duration from information_schema.profiling
27	#	select query_id, sum(duration) from information_schema.profiling group by query_id
28	#	select query_id, count(*) from information_schema.profiling group by query_id
29	#	select sum(duration) from information_schema.profiling
30	#	select query_id, count(*), sum(duration) from information_schema.profiling group by query_id
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
32	#	drop table if exists t1, t2, t3
33	#	SHOW WARNINGS
34	#	create table t1 (id int )
35	#	create table t2 (id int not null)
36	#	create table t3 (id int not null primary key)
37	#	insert into t1 values (1), (2), (3)
38	#	insert into t2 values (1), (2), (3)
39	#	insert into t3 values (1), (2), (3)
40	#	select * from t1
This ^^ should end in "select * from t1;"
delete from t1;
insert into t1 values (1), (2), (3);
insert into t1 values (1), (2), (3);
select * from t1;
id
1
2
3
1
2
3
show profiles;
Query_ID	Duration	Query
15	#	select count(*) from t1
16	#	insert into t1 select * from t1
17	#	insert into t1 select * from t1
18	#	insert into t1 select * from t1
19	#	select count(*) from t1
20	#	select sum(a) from t1
21	#	select sum(a) from t1 group by b
22	#	select sum(a) + sum(b) from t1 group by b
23	#	select max(x) from (select sum(a) as x from t1 group by b) as teeone
24	#	select '0123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345
25	#	select * from information_schema.profiling
26	#	select query_id, state, duration from information_schema.profiling
27	#	select query_id, sum(duration) from information_schema.profiling group by query_id
28	#	select query_id, count(*) from information_schema.profiling group by query_id
29	#	select sum(duration) from information_schema.profiling
30	#	select query_id, count(*), sum(duration) from information_schema.profiling group by query_id
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
32	#	drop table if exists t1, t2, t3
33	#	SHOW WARNINGS
34	#	create table t1 (id int )
35	#	create table t2 (id int not null)
36	#	create table t3 (id int not null primary key)
37	#	insert into t1 values (1), (2), (3)
38	#	insert into t2 values (1), (2), (3)
39	#	insert into t3 values (1), (2), (3)
40	#	select * from t1
41	#	delete from t1
42	#	insert into t1 values (1), (2), (3)
43	#	insert into t1 values (1), (2), (3)
44	#	select * from t1
set session profiling = OFF;
select sum(id) from t1;
sum(id)
12
show profiles;
Query_ID	Duration	Query
15	#	select count(*) from t1
16	#	insert into t1 select * from t1
17	#	insert into t1 select * from t1
18	#	insert into t1 select * from t1
19	#	select count(*) from t1
20	#	select sum(a) from t1
21	#	select sum(a) from t1 group by b
22	#	select sum(a) + sum(b) from t1 group by b
23	#	select max(x) from (select sum(a) as x from t1 group by b) as teeone
24	#	select '0123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345
25	#	select * from information_schema.profiling
26	#	select query_id, state, duration from information_schema.profiling
27	#	select query_id, sum(duration) from information_schema.profiling group by query_id
28	#	select query_id, count(*) from information_schema.profiling group by query_id
29	#	select sum(duration) from information_schema.profiling
30	#	select query_id, count(*), sum(duration) from information_schema.profiling group by query_id
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
32	#	drop table if exists t1, t2, t3
33	#	SHOW WARNINGS
34	#	create table t1 (id int )
35	#	create table t2 (id int not null)
36	#	create table t3 (id int not null primary key)
37	#	insert into t1 values (1), (2), (3)
38	#	insert into t2 values (1), (2), (3)
39	#	insert into t3 values (1), (2), (3)
40	#	select * from t1
41	#	delete from t1
42	#	insert into t1 values (1), (2), (3)
43	#	insert into t1 values (1), (2), (3)
44	#	select * from t1
set session profiling = ON;
select @@profiling;
@@profiling
1
create function f1() returns varchar(50) return 'hello';
select @@profiling;
@@profiling
1
select * from t1 where id <> f1();
id
1
2
3
1
2
3
Warnings:
Warning	1292	Truncated incorrect DECIMAL value: 'hello'
Warning	1292	Truncated incorrect DECIMAL value: 'hello'
Warning	1292	Truncated incorrect DECIMAL value: 'hello'
Warning	1292	Truncated incorrect DECIMAL value: 'hello'
Warning	1292	Truncated incorrect DECIMAL value: 'hello'
Warning	1292	Truncated incorrect DECIMAL value: 'hello'
select @@profiling;
@@profiling
1
set session profiling = OFF;
drop table if exists profile_log;
Warnings:
Note	1051	Unknown table 'test.profile_log'
create table profile_log (how_many int);
drop procedure if exists p1;
drop procedure if exists p2;
drop procedure if exists p3;
create procedure p1 () 
modifies sql data 
begin 
set profiling = ON; 
select 'This p1 should show up in profiling'; 
insert into profile_log select count(*) from information_schema.profiling; 
end//
create procedure p2() 
deterministic 
begin 
set profiling = ON; 
call p1(); 
select 'This p2 should show up in profiling'; 
end//
create procedure p3 () 
reads sql data 
begin 
set profiling = ON; 
select 'This p3 should show up in profiling'; 
show profile; 
end//
first call to p1
call p1;
select * from profile_log;
second call to p1
call p1;
select * from profile_log;
third call to p1
call p1;
select * from profile_log;
set session profiling = OFF;
call p2;
set session profiling = OFF;
call p3;
show profiles;
drop procedure if exists p1;
drop procedure if exists p2;
drop procedure if exists p3;
drop table if exists profile_log;
set session profiling = ON;
drop table if exists t2;
create table t2 (id int not null);
create trigger t2_bi before insert on t2 for each row set @x=0;
select @@profiling;
@@profiling
1
insert into t2 values (1), (2), (3);
select @@profiling;
@@profiling
1
set session profiling = ON;
drop table if exists t1, t2;
create table t1 (id int not null primary key);
create table t2 (id int not null primary key, id1 int not null);
select @@profiling;
@@profiling
1
alter table t2 add foreign key (id1) references t1 (id) on delete cascade;
select @@profiling;
@@profiling
1
lock table t1 write;
select @@profiling;
@@profiling
1
unlock table;
select @@profiling;
@@profiling
1
set autocommit=0;
select @@profiling, @@autocommit;
@@profiling	@@autocommit
1	0
begin;
select @@profiling;
@@profiling
1
insert into t1 values (1);
insert into t2 values (1,1);
testing referential integrity cascade
delete from t1 where id = 1;
select @@profiling;
@@profiling
1
testing rollback
rollback;
select @@profiling;
@@profiling
1
testing commit
begin;
select @@profiling;
@@profiling
1
commit;
select @@profiling;
@@profiling
1
drop table if exists t1, t2, t3;
drop view if exists v1;
Warnings:
Note	4092	Unknown VIEW: 'test.v1'
drop function if exists f1;
set session profiling = OFF;
set global profiling_history_size= @start_value;
End of 5.0 tests