~drizzle-trunk/drizzle/development

1 by brian
clean slate
1
flush status;
2
show status like 'Table_lock%';
3
Variable_name	Value
4
Table_locks_immediate	1
5
Table_locks_waited	0
6
select * from information_schema.session_status where variable_name like 'Table_lock%';
7
VARIABLE_NAME	VARIABLE_VALUE
8
TABLE_LOCKS_IMMEDIATE	2
9
TABLE_LOCKS_WAITED	0
10
SET SQL_LOG_BIN=0;
11
set @old_general_log = @@global.general_log;
12
set global general_log = 'OFF';
13
drop table if exists t1;
14
create table t1(n int) engine=myisam;
15
insert into t1 values(1);
16
lock tables t1 read;
17
unlock tables;
18
lock tables t1 read;
19
update t1 set n = 3;
20
unlock tables;
21
show status like 'Table_locks_waited';
22
Variable_name	Value
23
Table_locks_waited	1
24
drop table t1;
25
set global general_log = @old_general_log;
26
select 1;
27
1
28
1
29
show status like 'last_query_cost';
30
Variable_name	Value
31
Last_query_cost	0.000000
32
create table t1 (a int);
33
insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
34
insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
35
insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
36
insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
37
insert into t1 values (1),(2),(3),(4),(5),(6),(7),(8),(9),(10);
38
select * from t1 where a=6;
39
a
40
6
41
6
42
6
43
6
44
6
45
show status like 'last_query_cost';
46
Variable_name	Value
47
Last_query_cost	12.084449
48
show status like 'last_query_cost';
49
Variable_name	Value
50
Last_query_cost	12.084449
51
select 1;
52
1
53
1
54
show status like 'last_query_cost';
55
Variable_name	Value
56
Last_query_cost	0.000000
57
drop table t1;
58
FLUSH STATUS;
59
SHOW STATUS LIKE 'max_used_connections';
60
Variable_name	Value
61
Max_used_connections	1
62
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'max_used_connections';
63
VARIABLE_NAME	VARIABLE_VALUE
64
MAX_USED_CONNECTIONS	1
65
SET @save_thread_cache_size=@@thread_cache_size;
66
SET GLOBAL thread_cache_size=3;
67
SHOW STATUS LIKE 'max_used_connections';
68
Variable_name	Value
69
Max_used_connections	3
70
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'max_used_connections';
71
VARIABLE_NAME	VARIABLE_VALUE
72
MAX_USED_CONNECTIONS	3
73
FLUSH STATUS;
74
SHOW STATUS LIKE 'max_used_connections';
75
Variable_name	Value
76
Max_used_connections	2
77
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'max_used_connections';
78
VARIABLE_NAME	VARIABLE_VALUE
79
MAX_USED_CONNECTIONS	2
80
SHOW STATUS LIKE 'max_used_connections';
81
Variable_name	Value
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
86
SHOW STATUS LIKE 'max_used_connections';
87
Variable_name	Value
88
Max_used_connections	4
89
SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'max_used_connections';
90
VARIABLE_NAME	VARIABLE_VALUE
91
MAX_USED_CONNECTIONS	4
92
SET GLOBAL thread_cache_size=@save_thread_cache_size;
93
CREATE TABLE t1 ( a INT );
94
INSERT INTO t1 VALUES (1), (2);
95
SELECT a FROM t1 LIMIT 1;
96
a
97
1
98
SHOW SESSION STATUS LIKE 'Last_query_cost';
99
Variable_name	Value
100
Last_query_cost	2.402418
101
EXPLAIN SELECT a FROM t1;
102
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
103
1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	2	
104
SHOW SESSION STATUS LIKE 'Last_query_cost';
105
Variable_name	Value
106
Last_query_cost	2.402418
107
SELECT a FROM t1 UNION SELECT a FROM t1 ORDER BY a;
108
a
109
1
110
2
111
SHOW SESSION STATUS LIKE 'Last_query_cost';
112
Variable_name	Value
113
Last_query_cost	0.000000
114
EXPLAIN SELECT a FROM t1 UNION SELECT a FROM t1 ORDER BY a;
115
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
116
1	PRIMARY	t1	ALL	NULL	NULL	NULL	NULL	2	
117
2	UNION	t1	ALL	NULL	NULL	NULL	NULL	2	
118
NULL	UNION RESULT	<union1,2>	ALL	NULL	NULL	NULL	NULL	NULL	Using filesort
119
SHOW SESSION STATUS LIKE 'Last_query_cost';
120
Variable_name	Value
121
Last_query_cost	0.000000
122
SELECT a IN (SELECT a FROM t1) FROM t1 LIMIT 1;
123
a IN (SELECT a FROM t1)
124
1
125
SHOW SESSION STATUS LIKE 'Last_query_cost';
126
Variable_name	Value
127
Last_query_cost	0.000000
128
SELECT (SELECT a FROM t1 LIMIT 1) x FROM t1 LIMIT 1;
129
x
130
1
131
SHOW SESSION STATUS LIKE 'Last_query_cost';
132
Variable_name	Value
133
Last_query_cost	0.000000
134
SELECT * FROM t1 a, t1 b LIMIT 1;
135
a	a
136
1	1
137
SHOW SESSION STATUS LIKE 'Last_query_cost';
138
Variable_name	Value
139
Last_query_cost	4.805836
140
DROP TABLE t1;
141
show status like 'com_show_status';
142
Variable_name	Value
143
Com_show_status	3
144
show status like 'hand%write%';
145
Variable_name	Value
146
Handler_write	5
147
show status like '%tmp%';
148
Variable_name	Value
149
Created_tmp_disk_tables	0
150
Created_tmp_files	0
151
Created_tmp_tables	0
152
show status like 'hand%write%';
153
Variable_name	Value
154
Handler_write	7
155
show status like '%tmp%';
156
Variable_name	Value
157
Created_tmp_disk_tables	0
158
Created_tmp_files	0
159
Created_tmp_tables	0
160
show status like 'com_show_status';
161
Variable_name	Value
162
Com_show_status	8
163
rnd_diff	tmp_table_diff
164
20	8
165
show global status like 'Com%function%';
166
Variable_name	Value
167
Com_alter_function	0
168
Com_create_function	0
169
Com_drop_function	0
170
Com_show_function_code	0
171
Com_show_function_status	0
172
create function f1 (x INTEGER) returns integer
173
begin
174
declare ret integer;
175
set ret = x * 10;
176
return ret;
177
end //
178
drop function f1;
179
show global status like 'Com%function%';
180
Variable_name	Value
181
Com_alter_function	0
182
Com_create_function	1
183
Com_drop_function	1
184
Com_show_function_code	0
185
Com_show_function_status	0
186
SELECT VARIABLE_VALUE INTO @tc FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Threads_connected';
187
SELECT VARIABLE_NAME FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Threads_created' AND VARIABLE_VALUE < @tc;
188
VARIABLE_NAME
189
SELECT VARIABLE_VALUE INTO @tr FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Threads_running';
190
FLUSH STATUS;
191
SELECT * FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Threads_connected' AND VARIABLE_VALUE < @tc;
192
VARIABLE_NAME	VARIABLE_VALUE
193
SELECT * FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'Threads_running' AND VARIABLE_VALUE < @tr;
194
VARIABLE_NAME	VARIABLE_VALUE