~drizzle-trunk/drizzle/development

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
flush status;
drop table if exists t1;
select 1;
1
1
show status like 'last_query_cost';
Variable_name	Value
Last_query_cost	#
create temporary table t1 (a int) engine=myisam;
insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
select * from t1 where a=6;
a
6
6
6
6
6
show status like 'last_query_cost';
Variable_name	Value
Last_query_cost	#
show status like 'last_query_cost';
Variable_name	Value
Last_query_cost	#
select 1;
1
1
show status like 'last_query_cost';
Variable_name	Value
Last_query_cost	#
drop table t1;
FLUSH STATUS;
SELECT ASSERT(VARIABLE_VALUE = 1) FROM data_dictionary.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'max_used_connections';
ASSERT(VARIABLE_VALUE = 1)
1
SELECT ASSERT(VARIABLE_VALUE >= 3) FROM data_dictionary.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'max_used_connections';
ASSERT(VARIABLE_VALUE >= 3)
1
CREATE TABLE t1 ( a INT );
INSERT INTO t1 VALUES (1), (2);
SELECT a FROM t1 LIMIT 1;
a
1
SHOW SESSION STATUS LIKE 'Last_query_cost';
Variable_name	Value
Last_query_cost	1.399
EXPLAIN SELECT a FROM t1;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	#	
SHOW SESSION STATUS LIKE 'Last_query_cost';
Variable_name	Value
Last_query_cost	1.399
SELECT a FROM t1 UNION SELECT a FROM t1 ORDER BY a;
a
1
2
SHOW SESSION STATUS LIKE 'Last_query_cost';
Variable_name	Value
Last_query_cost	0
EXPLAIN SELECT a FROM t1 UNION SELECT a FROM t1 ORDER BY a;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	PRIMARY	t1	ALL	NULL	NULL	NULL	NULL	#	
2	UNION	t1	ALL	NULL	NULL	NULL	NULL	#	
NULL	UNION RESULT	<union1,2>	ALL	NULL	NULL	NULL	NULL	#	Using filesort
SHOW SESSION STATUS LIKE 'Last_query_cost';
Variable_name	Value
Last_query_cost	0
SELECT a IN (SELECT a FROM t1) FROM t1 LIMIT 1;
a IN (SELECT a FROM t1)
1
SHOW SESSION STATUS LIKE 'Last_query_cost';
Variable_name	Value
Last_query_cost	0
SELECT (SELECT a FROM t1 LIMIT 1) x FROM t1 LIMIT 1;
x
1
SHOW SESSION STATUS LIKE 'Last_query_cost';
Variable_name	Value
Last_query_cost	0
SELECT * FROM t1 a CROSS JOIN t1 b LIMIT 1;
a	a
1	1
SHOW SESSION STATUS LIKE 'Last_query_cost';
Variable_name	Value
Last_query_cost	2.799
DROP TABLE t1;