2
drop table if exists t1;
6
show status like 'last_query_cost';
9
create temporary table t1 (a int) engine=myisam;
10
insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
11
insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
12
insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
13
insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
14
insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
15
select * from t1 where a=6;
22
show status like 'last_query_cost';
25
show status like 'last_query_cost';
31
show status like 'last_query_cost';
36
SHOW STATUS LIKE 'max_used_connections';
38
Max_used_connections 1
39
SELECT * FROM data_dictionary.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'max_used_connections';
40
VARIABLE_NAME VARIABLE_VALUE
41
Max_used_connections 1
42
SHOW STATUS LIKE 'max_used_connections';
44
Max_used_connections 3
45
SELECT * FROM data_dictionary.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'max_used_connections';
46
VARIABLE_NAME VARIABLE_VALUE
47
Max_used_connections 3
48
CREATE TABLE t1 ( a INT );
49
INSERT INTO t1 VALUES (1), (2);
50
SELECT a FROM t1 LIMIT 1;
53
SHOW SESSION STATUS LIKE 'Last_query_cost';
55
Last_query_cost 21.999
56
EXPLAIN SELECT a FROM t1;
57
id select_type table type possible_keys key key_len ref rows Extra
58
1 SIMPLE t1 ALL NULL NULL NULL NULL #
59
SHOW SESSION STATUS LIKE 'Last_query_cost';
61
Last_query_cost 21.999
62
SELECT a FROM t1 UNION SELECT a FROM t1 ORDER BY a;
66
SHOW SESSION STATUS LIKE 'Last_query_cost';
68
Last_query_cost 21.999
69
EXPLAIN SELECT a FROM t1 UNION SELECT a FROM t1 ORDER BY a;
70
id select_type table type possible_keys key key_len ref rows Extra
71
1 PRIMARY t1 ALL NULL NULL NULL NULL #
72
2 UNION t1 ALL NULL NULL NULL NULL #
73
NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL # Using filesort
74
SHOW SESSION STATUS LIKE 'Last_query_cost';
76
Last_query_cost 21.999
77
SELECT a IN (SELECT a FROM t1) FROM t1 LIMIT 1;
78
a IN (SELECT a FROM t1)
80
SHOW SESSION STATUS LIKE 'Last_query_cost';
82
Last_query_cost 21.999
83
SELECT (SELECT a FROM t1 LIMIT 1) x FROM t1 LIMIT 1;
86
SHOW SESSION STATUS LIKE 'Last_query_cost';
88
Last_query_cost 21.999
89
SELECT * FROM t1 a, t1 b LIMIT 1;
92
SHOW SESSION STATUS LIKE 'Last_query_cost';
94
Last_query_cost 21.999