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 @start_value= @@global.profiling_history_size;
15 set global profiling_history_size=100;
16 show global variables like 'profil%';
19 profiling_history_size 100
20 set session profiling = ON;
21 set session profiling_history_size=30;
22 show session variables like 'profil%';
25 profiling_history_size 30
33 insert into t1 values (1,1), (2,null), (3, 4);
34 insert into t1 values (5,1), (6,null), (7, 4);
35 insert into t1 values (1,1), (2,null), (3, 4);
36 insert into t1 values (5,1), (6,null), (7, 4);
37 select max(x) from (select sum(a) as x from t1 group by b) as teeone;
40 insert into t1 select * from t1;
41 select count(*) from t1;
44 insert into t1 select * from t1;
45 insert into t1 select * from t1;
46 insert into t1 select * from t1;
47 select count(*) from t1;
50 insert into t1 select * from t1;
51 insert into t1 select * from t1;
52 insert into t1 select * from t1;
53 select count(*) from t1;
56 select sum(a) from t1;
59 select sum(a) from t1 group by b;
64 select sum(a) + sum(b) from t1 group by b;
69 select max(x) from (select sum(a) as x from t1 group by b) as teeone;
72 select '012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890' as big_string;
74 012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890
76 Query_ID Duration Query
77 1 # set session profiling_history_size=30
78 2 # show session variables like 'profil%'
79 3 # select @@profiling
84 5 # insert into t1 values (1,1), (2,null), (3, 4)
85 6 # insert into t1 values (5,1), (6,null), (7, 4)
86 7 # insert into t1 values (1,1), (2,null), (3, 4)
87 8 # insert into t1 values (5,1), (6,null), (7, 4)
88 9 # select max(x) from (select sum(a) as x from t1 group by b) as teeone
89 10 # insert into t1 select * from t1
90 11 # select count(*) from t1
91 12 # insert into t1 select * from t1
92 13 # insert into t1 select * from t1
93 14 # insert into t1 select * from t1
94 15 # select count(*) from t1
95 16 # insert into t1 select * from t1
96 17 # insert into t1 select * from t1
97 18 # insert into t1 select * from t1
98 19 # select count(*) from t1
99 20 # select sum(a) from t1
100 21 # select sum(a) from t1 group by b
101 22 # select sum(a) + sum(b) from t1 group by b
102 23 # select max(x) from (select sum(a) as x from t1 group by b) as teeone
103 24 # select '0123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345
104 show profile for query 15;
105 show profile cpu for query 15;
106 show profile cpu, block io for query 15;
107 show profile cpu for query 9 limit 2 offset 2;
108 show profile cpu for query 10 limit 0;
109 show profile cpu for query 65534;
111 show profile block io;
112 show profile context switches;
113 show profile page faults;
115 show profile swaps limit 1 offset 2;
117 show profile all for query 0 limit 0;
118 show profile all for query 15;
119 select * from information_schema.profiling;
120 select query_id, state, duration from information_schema.profiling;
121 select query_id, sum(duration) from information_schema.profiling group by query_id;
122 select query_id, count(*) from information_schema.profiling group by query_id;
123 select sum(duration) from information_schema.profiling;
124 select query_id, count(*), sum(duration) from information_schema.profiling group by query_id;
125 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;
126 drop table if exists t1, t2, t3;
128 Note 1051 Unknown table 't2'
129 Note 1051 Unknown table 't3'
130 create table t1 (id int );
131 create table t2 (id int not null);
132 create table t3 (id int not null primary key);
133 insert into t1 values (1), (2), (3);
134 insert into t2 values (1), (2), (3);
135 insert into t3 values (1), (2), (3);
137 Query_ID Duration Query
138 10 # insert into t1 select * from t1
139 11 # select count(*) from t1
140 12 # insert into t1 select * from t1
141 13 # insert into t1 select * from t1
142 14 # insert into t1 select * from t1
143 15 # select count(*) from t1
144 16 # insert into t1 select * from t1
145 17 # insert into t1 select * from t1
146 18 # insert into t1 select * from t1
147 19 # select count(*) from t1
148 20 # select sum(a) from t1
149 21 # select sum(a) from t1 group by b
150 22 # select sum(a) + sum(b) from t1 group by b
151 23 # select max(x) from (select sum(a) as x from t1 group by b) as teeone
152 24 # select '0123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345
153 25 # select * from information_schema.profiling
154 26 # select query_id, state, duration from information_schema.profiling
155 27 # select query_id, sum(duration) from information_schema.profiling group by query_id
156 28 # select query_id, count(*) from information_schema.profiling group by query_id
157 29 # select sum(duration) from information_schema.profiling
158 30 # select query_id, count(*), sum(duration) from information_schema.profiling group by query_id
159 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
160 32 # drop table if exists t1, t2, t3
162 34 # create table t1 (id int )
163 35 # create table t2 (id int not null)
164 36 # create table t3 (id int not null primary key)
165 37 # insert into t1 values (1), (2), (3)
166 38 # insert into t2 values (1), (2), (3)
167 39 # insert into t3 values (1), (2), (3)
174 Query_ID Duration Query
175 11 # select count(*) from t1
176 12 # insert into t1 select * from t1
177 13 # insert into t1 select * from t1
178 14 # insert into t1 select * from t1
179 15 # select count(*) from t1
180 16 # insert into t1 select * from t1
181 17 # insert into t1 select * from t1
182 18 # insert into t1 select * from t1
183 19 # select count(*) from t1
184 20 # select sum(a) from t1
185 21 # select sum(a) from t1 group by b
186 22 # select sum(a) + sum(b) from t1 group by b
187 23 # select max(x) from (select sum(a) as x from t1 group by b) as teeone
188 24 # select '0123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345
189 25 # select * from information_schema.profiling
190 26 # select query_id, state, duration from information_schema.profiling
191 27 # select query_id, sum(duration) from information_schema.profiling group by query_id
192 28 # select query_id, count(*) from information_schema.profiling group by query_id
193 29 # select sum(duration) from information_schema.profiling
194 30 # select query_id, count(*), sum(duration) from information_schema.profiling group by query_id
195 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
196 32 # drop table if exists t1, t2, t3
198 34 # create table t1 (id int )
199 35 # create table t2 (id int not null)
200 36 # create table t3 (id int not null primary key)
201 37 # insert into t1 values (1), (2), (3)
202 38 # insert into t2 values (1), (2), (3)
203 39 # insert into t3 values (1), (2), (3)
204 40 # select * from t1
205 This ^^ should end in "select * from t1;"
207 insert into t1 values (1), (2), (3);
208 insert into t1 values (1), (2), (3);
218 Query_ID Duration Query
219 15 # select count(*) from t1
220 16 # insert into t1 select * from t1
221 17 # insert into t1 select * from t1
222 18 # insert into t1 select * from t1
223 19 # select count(*) from t1
224 20 # select sum(a) from t1
225 21 # select sum(a) from t1 group by b
226 22 # select sum(a) + sum(b) from t1 group by b
227 23 # select max(x) from (select sum(a) as x from t1 group by b) as teeone
228 24 # select '0123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345
229 25 # select * from information_schema.profiling
230 26 # select query_id, state, duration from information_schema.profiling
231 27 # select query_id, sum(duration) from information_schema.profiling group by query_id
232 28 # select query_id, count(*) from information_schema.profiling group by query_id
233 29 # select sum(duration) from information_schema.profiling
234 30 # select query_id, count(*), sum(duration) from information_schema.profiling group by query_id
235 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
236 32 # drop table if exists t1, t2, t3
238 34 # create table t1 (id int )
239 35 # create table t2 (id int not null)
240 36 # create table t3 (id int not null primary key)
241 37 # insert into t1 values (1), (2), (3)
242 38 # insert into t2 values (1), (2), (3)
243 39 # insert into t3 values (1), (2), (3)
244 40 # select * from t1
246 42 # insert into t1 values (1), (2), (3)
247 43 # insert into t1 values (1), (2), (3)
248 44 # select * from t1
249 set session profiling = OFF;
250 select sum(id) from t1;
254 Query_ID Duration Query
255 15 # select count(*) from t1
256 16 # insert into t1 select * from t1
257 17 # insert into t1 select * from t1
258 18 # insert into t1 select * from t1
259 19 # select count(*) from t1
260 20 # select sum(a) from t1
261 21 # select sum(a) from t1 group by b
262 22 # select sum(a) + sum(b) from t1 group by b
263 23 # select max(x) from (select sum(a) as x from t1 group by b) as teeone
264 24 # select '0123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345678900123456789001234567890012345
265 25 # select * from information_schema.profiling
266 26 # select query_id, state, duration from information_schema.profiling
267 27 # select query_id, sum(duration) from information_schema.profiling group by query_id
268 28 # select query_id, count(*) from information_schema.profiling group by query_id
269 29 # select sum(duration) from information_schema.profiling
270 30 # select query_id, count(*), sum(duration) from information_schema.profiling group by query_id
271 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
272 32 # drop table if exists t1, t2, t3
274 34 # create table t1 (id int )
275 35 # create table t2 (id int not null)
276 36 # create table t3 (id int not null primary key)
277 37 # insert into t1 values (1), (2), (3)
278 38 # insert into t2 values (1), (2), (3)
279 39 # insert into t3 values (1), (2), (3)
280 40 # select * from t1
282 42 # insert into t1 values (1), (2), (3)
283 43 # insert into t1 values (1), (2), (3)
284 44 # select * from t1
285 set session profiling = ON;
289 create function f1() returns varchar(50) return 'hello';
293 select * from t1 where id <> f1();
304 set session profiling = OFF;
305 drop table if exists profile_log;
307 Note 1051 Unknown table 'profile_log'
308 create table profile_log (how_many int);
309 drop procedure if exists p1;
310 drop procedure if exists p2;
311 drop procedure if exists p3;
312 create procedure p1 ()
316 select 'This p1 should show up in profiling';
317 insert into profile_log select count(*) from information_schema.profiling;
319 create procedure p2()
324 select 'This p2 should show up in profiling';
326 create procedure p3 ()
330 select 'This p3 should show up in profiling';
335 select * from profile_log;
338 select * from profile_log;
341 select * from profile_log;
342 set session profiling = OFF;
344 set session profiling = OFF;
347 drop procedure if exists p1;
348 drop procedure if exists p2;
349 drop procedure if exists p3;
350 drop table if exists profile_log;
351 set session profiling = ON;
352 drop table if exists t2;
353 create table t2 (id int not null);
354 create trigger t2_bi before insert on t2 for each row set @x=0;
358 insert into t2 values (1), (2), (3);
362 set session profiling = ON;
363 drop table if exists t1, t2;
364 create table t1 (id int not null primary key);
365 create table t2 (id int not null primary key, id1 int not null);
369 alter table t2 add foreign key (id1) references t1 (id) on delete cascade;
382 select @@profiling, @@autocommit;
383 @@profiling @@autocommit
389 insert into t1 values (1);
390 insert into t2 values (1,1);
391 testing referential integrity cascade
392 delete from t1 where id = 1;
410 drop table if exists t1, t2, t3;
411 drop view if exists v1;
413 Note 1051 Unknown table 'test.v1'
414 drop function if exists f1;
415 set session profiling = OFF;
416 set global profiling_history_size= @start_value;