1
set @old_concurrent_insert= @@global.concurrent_insert;
2
set @@global.concurrent_insert= 0;
3
SET @old_log_output = @@global.log_output;
4
SET GLOBAL LOG_OUTPUT = 'FILE';
6
show status like 'Table_lock%';
8
Table_locks_immediate 0
10
select * from information_schema.session_status where variable_name like 'Table_lock%';
11
VARIABLE_NAME VARIABLE_VALUE
12
TABLE_LOCKS_IMMEDIATE 0
14
# Switched to connection: con1
16
set @old_general_log = @@global.general_log;
17
set global general_log = 'OFF';
18
drop table if exists t1;
19
create table t1(n int) engine=myisam;
20
insert into t1 values(1);
24
# Switched to connection: con2
28
# Switched to connection: con1
30
# Switched to connection: con2
32
# Switched to connection: con1
33
show status like 'Table_locks_waited';
37
set global general_log = @old_general_log;
38
# Switched to connection: default
42
show status like 'last_query_cost';
44
Last_query_cost 0.000000
45
create table t1 (a int);
46
insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
47
insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
48
insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
49
insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
50
insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
51
select * from t1 where a=6;
58
show status like 'last_query_cost';
60
Last_query_cost 12.084449
61
show status like 'last_query_cost';
63
Last_query_cost 12.084449
67
show status like 'last_query_cost';
69
Last_query_cost 0.000000
72
SHOW STATUS LIKE 'max_used_connections';
74
Max_used_connections 1
75
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'max_used_connections';
76
VARIABLE_NAME VARIABLE_VALUE
77
MAX_USED_CONNECTIONS 1
78
SET @save_thread_cache_size=@@thread_cache_size;
79
SET GLOBAL thread_cache_size=3;
80
SHOW STATUS LIKE 'max_used_connections';
82
Max_used_connections 3
83
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'max_used_connections';
84
VARIABLE_NAME VARIABLE_VALUE
85
MAX_USED_CONNECTIONS 3
87
SHOW STATUS LIKE 'max_used_connections';
89
Max_used_connections 2
90
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'max_used_connections';
91
VARIABLE_NAME VARIABLE_VALUE
92
MAX_USED_CONNECTIONS 2
93
SHOW STATUS LIKE 'max_used_connections';
95
Max_used_connections 3
96
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'max_used_connections';
97
VARIABLE_NAME VARIABLE_VALUE
98
MAX_USED_CONNECTIONS 3
99
SHOW STATUS LIKE 'max_used_connections';
101
Max_used_connections 4
102
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'max_used_connections';
103
VARIABLE_NAME VARIABLE_VALUE
104
MAX_USED_CONNECTIONS 4
105
SET GLOBAL thread_cache_size=@save_thread_cache_size;
106
CREATE TABLE t1 ( a INT );
107
INSERT INTO t1 VALUES (1), (2);
108
SELECT a FROM t1 LIMIT 1;
111
SHOW SESSION STATUS LIKE 'Last_query_cost';
113
Last_query_cost 2.402418
114
EXPLAIN SELECT a FROM t1;
115
id select_type table type possible_keys key key_len ref rows Extra
116
1 SIMPLE t1 ALL NULL NULL NULL NULL 2
117
SHOW SESSION STATUS LIKE 'Last_query_cost';
119
Last_query_cost 2.402418
120
SELECT a FROM t1 UNION SELECT a FROM t1 ORDER BY a;
124
SHOW SESSION STATUS LIKE 'Last_query_cost';
126
Last_query_cost 0.000000
127
EXPLAIN SELECT a FROM t1 UNION SELECT a FROM t1 ORDER BY a;
128
id select_type table type possible_keys key key_len ref rows Extra
129
1 PRIMARY t1 ALL NULL NULL NULL NULL 2
130
2 UNION t1 ALL NULL NULL NULL NULL 2
131
NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL Using filesort
132
SHOW SESSION STATUS LIKE 'Last_query_cost';
134
Last_query_cost 0.000000
135
SELECT a IN (SELECT a FROM t1) FROM t1 LIMIT 1;
136
a IN (SELECT a FROM t1)
138
SHOW SESSION STATUS LIKE 'Last_query_cost';
140
Last_query_cost 0.000000
141
SELECT (SELECT a FROM t1 LIMIT 1) x FROM t1 LIMIT 1;
144
SHOW SESSION STATUS LIKE 'Last_query_cost';
146
Last_query_cost 0.000000
147
SELECT * FROM t1 a, t1 b LIMIT 1;
150
SHOW SESSION STATUS LIKE 'Last_query_cost';
152
Last_query_cost 4.805836
154
show status like 'com_show_status';
157
show status like 'hand%write%';
160
show status like '%tmp%';
162
Created_tmp_disk_tables 0
165
show status like 'hand%write%';
168
show status like '%tmp%';
170
Created_tmp_disk_tables 0
173
show status like 'com_show_status';
176
rnd_diff tmp_table_diff
179
show status like 'Com%function';
182
Com_create_function 0
184
create function f1 (x INTEGER) returns integer
191
show status like 'Com%function';
194
Com_create_function 1
196
create database db37908;
197
create table db37908.t1(f1 int);
198
insert into db37908.t1 values(1);
199
grant usage,execute on test.* to mysqltest_1@localhost;
200
create procedure proc37908() begin select 1; end |
201
create function func37908() returns int sql security invoker
202
return (select * from db37908.t1 limit 1)|
203
select * from db37908.t1;
204
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 't1'
205
show status where variable_name ='uptime' and 2 in (select * from db37908.t1);
206
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 't1'
207
show procedure status where name ='proc37908' and 1 in (select f1 from db37908.t1);
208
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 't1'
209
show function status where name ='func37908' and 1 in (select func37908());
210
ERROR 42000: SELECT command denied to user 'mysqltest_1'@'localhost' for table 't1'
211
drop database db37908;
212
drop procedure proc37908;
213
drop function func37908;
214
REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost;
215
DROP USER mysqltest_1@localhost;
216
DROP PROCEDURE IF EXISTS p1;
217
DROP FUNCTION IF EXISTS f1;
218
CREATE FUNCTION f1() RETURNS INTEGER
226
CREATE PROCEDURE p1()
241
set @@global.concurrent_insert= @old_concurrent_insert;
242
SET GLOBAL log_output = @old_log_output;