1
by brian
clean slate |
1 |
drop table if exists t1, t2, t3; |
2 |
SET @save_key_buffer=@@key_buffer_size; |
|
3 |
SELECT @@key_buffer_size, @@small.key_buffer_size; |
|
4 |
@@key_buffer_size @@small.key_buffer_size |
|
766
by Brian Aker
Fixed key_cache test |
5 |
1048576 0 |
1
by brian
clean slate |
6 |
SET @@global.key_buffer_size=16*1024*1024; |
7 |
SET @@global.default.key_buffer_size=16*1024*1024; |
|
8 |
SET @@global.default.key_buffer_size=16*1024*1024; |
|
9 |
SET @@global.small.key_buffer_size=1*1024*1024; |
|
10 |
SET @@global.medium.key_buffer_size=4*1024*1024; |
|
11 |
SET @@global.medium.key_buffer_size=0; |
|
12 |
SET @@global.medium.key_buffer_size=0; |
|
13 |
SHOW VARIABLES like "key_buffer_size"; |
|
14 |
Variable_name Value |
|
15 |
key_buffer_size 16777216 |
|
16 |
SELECT @@key_buffer_size; |
|
17 |
@@key_buffer_size
|
|
18 |
16777216
|
|
19 |
SELECT @@global.key_buffer_size; |
|
20 |
@@global.key_buffer_size
|
|
21 |
16777216
|
|
22 |
SELECT @@global.default.key_buffer_size; |
|
23 |
@@global.default.key_buffer_size |
|
24 |
16777216
|
|
25 |
SELECT @@global.default.`key_buffer_size`; |
|
26 |
@@global.default.`key_buffer_size` |
|
27 |
16777216
|
|
28 |
SELECT @@global.`default`.`key_buffer_size`; |
|
29 |
@@global.`default`.`key_buffer_size` |
|
30 |
16777216
|
|
31 |
SELECT @@`default`.key_buffer_size; |
|
32 |
@@`default`.key_buffer_size |
|
33 |
16777216
|
|
34 |
SELECT @@small.key_buffer_size; |
|
35 |
@@small.key_buffer_size |
|
36 |
1048576
|
|
37 |
SELECT @@medium.key_buffer_size; |
|
38 |
@@medium.key_buffer_size |
|
39 |
0
|
|
40 |
SET @@global.key_buffer_size=@save_key_buffer; |
|
41 |
SELECT @@default.key_buffer_size; |
|
766
by Brian Aker
Fixed key_cache test |
42 |
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your Drizzle server version for the right syntax to use near 'default.key_buffer_size' at line 1 |
1
by brian
clean slate |
43 |
SELECT @@skr.storage_engine="test"; |
44 |
ERROR HY000: Variable 'storage_engine' is not a variable component (can't be used as XXXX.variable_name) |
|
45 |
select @@keycache1.key_cache_block_size;
|
|
46 |
@@keycache1.key_cache_block_size
|
|
47 |
0
|
|
48 |
select @@keycache1.key_buffer_size;
|
|
49 |
@@keycache1.key_buffer_size
|
|
50 |
0
|
|
51 |
set global keycache1.key_cache_block_size=2048;
|
|
52 |
select @@keycache1.key_buffer_size;
|
|
53 |
@@keycache1.key_buffer_size
|
|
54 |
0
|
|
55 |
select @@keycache1.key_cache_block_size;
|
|
56 |
@@keycache1.key_cache_block_size
|
|
57 |
2048
|
|
58 |
set global keycache1.key_buffer_size=1*1024*1024;
|
|
59 |
select @@keycache1.key_buffer_size;
|
|
60 |
@@keycache1.key_buffer_size
|
|
61 |
1048576
|
|
62 |
select @@keycache1.key_cache_block_size;
|
|
63 |
@@keycache1.key_cache_block_size
|
|
64 |
2048
|
|
65 |
set global keycache2.key_buffer_size=4*1024*1024;
|
|
66 |
select @@keycache2.key_buffer_size;
|
|
67 |
@@keycache2.key_buffer_size
|
|
68 |
4194304
|
|
69 |
select @@keycache2.key_cache_block_size;
|
|
70 |
@@keycache2.key_cache_block_size
|
|
71 |
1024
|
|
72 |
set global keycache1.key_buffer_size=0;
|
|
73 |
select @@keycache1.key_buffer_size;
|
|
74 |
@@keycache1.key_buffer_size
|
|
75 |
0
|
|
76 |
select @@keycache1.key_cache_block_size;
|
|
77 |
@@keycache1.key_cache_block_size
|
|
78 |
2048
|
|
79 |
select @@key_buffer_size;
|
|
80 |
@@key_buffer_size
|
|
766
by Brian Aker
Fixed key_cache test |
81 |
1048576
|
1
by brian
clean slate |
82 |
select @@key_cache_block_size;
|
83 |
@@key_cache_block_size
|
|
84 |
1024
|
|
85 |
set global keycache1.key_buffer_size=1024*1024;
|
|
766
by Brian Aker
Fixed key_cache test |
86 |
create table t1 (p int primary key, a char(10)) delay_key_write=1 ENGINE=myisam;
|
87 |
create table t2 (p int primary key, i int, a char(10), key k1(i), key k2(a)) ENGINE=myisam;
|
|
1
by brian
clean slate |
88 |
show status like 'key_blocks_used'; |
89 |
Variable_name Value
|
|
90 |
Key_blocks_used 0
|
|
91 |
show status like 'key_blocks_unused'; |
|
92 |
Variable_name Value
|
|
766
by Brian Aker
Fixed key_cache test |
93 |
Key_blocks_unused 837
|
1
by brian
clean slate |
94 |
insert into t1 values (1, 'qqqq'), (11, 'yyyy'); |
95 |
insert into t2 values (1, 1, 'qqqq'), (2, 1, 'pppp'), |
|
96 |
(3, 1, 'yyyy'), (4, 3, 'zzzz'); |
|
97 |
select * from t1;
|
|
98 |
p a
|
|
99 |
1 qqqq
|
|
100 |
11 yyyy
|
|
101 |
select * from t2;
|
|
102 |
p i a
|
|
103 |
1 1 qqqq
|
|
104 |
2 1 pppp
|
|
105 |
3 1 yyyy
|
|
106 |
4 3 zzzz
|
|
107 |
update t1 set p=2 where p=1;
|
|
108 |
update t2 set i=2 where i=1;
|
|
109 |
show status like 'key_blocks_used'; |
|
110 |
Variable_name Value
|
|
111 |
Key_blocks_used 4
|
|
112 |
show status like 'key_blocks_unused'; |
|
113 |
Variable_name Value
|
|
766
by Brian Aker
Fixed key_cache test |
114 |
Key_blocks_unused 833
|
1
by brian
clean slate |
115 |
cache index t1 key (`primary`) in keycache1;
|
116 |
Table Op Msg_type Msg_text
|
|
117 |
test.t1 assign_to_keycache status OK
|
|
118 |
explain select p from t1;
|
|
119 |
id select_type table type possible_keys key key_len ref rows Extra
|
|
120 |
1 SIMPLE t1 index NULL PRIMARY 4 NULL 2 Using index
|
|
121 |
select p from t1;
|
|
122 |
p
|
|
123 |
2
|
|
124 |
11
|
|
125 |
explain select i from t2;
|
|
126 |
id select_type table type possible_keys key key_len ref rows Extra
|
|
127 |
1 SIMPLE t2 index NULL k1 5 NULL 4 Using index
|
|
128 |
select i from t2;
|
|
129 |
i
|
|
130 |
2
|
|
131 |
2
|
|
132 |
2
|
|
133 |
3
|
|
134 |
explain select count(*) from t1, t2 where t1.p = t2.i;
|
|
135 |
id select_type table type possible_keys key key_len ref rows Extra
|
|
136 |
1 SIMPLE t1 index PRIMARY PRIMARY 4 NULL 2 Using index
|
|
137 |
1 SIMPLE t2 ref k1 k1 5 test.t1.p 2 Using index
|
|
138 |
select count(*) from t1, t2 where t1.p = t2.i;
|
|
139 |
count(*)
|
|
140 |
3
|
|
141 |
cache index t2 in keycache1;
|
|
142 |
Table Op Msg_type Msg_text
|
|
143 |
test.t2 assign_to_keycache status OK
|
|
144 |
update t2 set p=p+1000, i=2 where a='qqqq'; |
|
145 |
cache index t2 in keycache2;
|
|
146 |
Table Op Msg_type Msg_text
|
|
147 |
test.t2 assign_to_keycache status OK
|
|
148 |
insert into t2 values (2000, 3, 'yyyy'); |
|
149 |
cache index t2 in keycache1;
|
|
150 |
Table Op Msg_type Msg_text
|
|
151 |
test.t2 assign_to_keycache status OK
|
|
152 |
update t2 set p=3000 where a='zzzz'; |
|
153 |
select * from t2;
|
|
154 |
p i a
|
|
155 |
1001 2 qqqq
|
|
156 |
2 2 pppp
|
|
157 |
3 2 yyyy
|
|
158 |
3000 3 zzzz
|
|
159 |
2000 3 yyyy
|
|
160 |
explain select p from t2;
|
|
161 |
id select_type table type possible_keys key key_len ref rows Extra
|
|
162 |
1 SIMPLE t2 index NULL PRIMARY 4 NULL 5 Using index
|
|
163 |
select p from t2;
|
|
164 |
p
|
|
165 |
2
|
|
166 |
3
|
|
167 |
1001
|
|
168 |
2000
|
|
169 |
3000
|
|
170 |
explain select i from t2;
|
|
171 |
id select_type table type possible_keys key key_len ref rows Extra
|
|
172 |
1 SIMPLE t2 index NULL k1 5 NULL 5 Using index
|
|
173 |
select i from t2;
|
|
174 |
i
|
|
175 |
2
|
|
176 |
2
|
|
177 |
2
|
|
178 |
3
|
|
179 |
3
|
|
180 |
explain select a from t2;
|
|
181 |
id select_type table type possible_keys key key_len ref rows Extra
|
|
766
by Brian Aker
Fixed key_cache test |
182 |
1 SIMPLE t2 index NULL k2 43 NULL 5 Using index
|
1
by brian
clean slate |
183 |
select a from t2;
|
184 |
a
|
|
185 |
pppp
|
|
186 |
qqqq
|
|
187 |
yyyy
|
|
188 |
yyyy
|
|
189 |
zzzz
|
|
190 |
cache index t1 in unknown_key_cache;
|
|
191 |
ERROR HY000: Unknown key cache 'unknown_key_cache' |
|
192 |
cache index t1 key (unknown_key) in keycache1;
|
|
193 |
Table Op Msg_type Msg_text
|
|
194 |
test.t1 assign_to_keycache Error Key 'unknown_key' doesn't exist in table 't1' |
|
195 |
test.t1 assign_to_keycache status Operation failed |
|
196 |
select @@keycache2.key_buffer_size; |
|
197 |
@@keycache2.key_buffer_size |
|
198 |
4194304
|
|
199 |
select @@keycache2.key_cache_block_size; |
|
200 |
@@keycache2.key_cache_block_size |
|
201 |
1024
|
|
202 |
set global keycache2.key_buffer_size=0; |
|
203 |
select @@keycache2.key_buffer_size; |
|
204 |
@@keycache2.key_buffer_size |
|
205 |
0
|
|
206 |
select @@keycache2.key_cache_block_size; |
|
207 |
@@keycache2.key_cache_block_size |
|
208 |
1024
|
|
209 |
set global keycache2.key_buffer_size=1024*1024; |
|
210 |
select @@keycache2.key_buffer_size; |
|
211 |
@@keycache2.key_buffer_size |
|
212 |
1048576
|
|
213 |
update t2 set p=4000 where a='zzzz'; |
|
214 |
update t1 set p=p+1; |
|
215 |
set global keycache1.key_buffer_size=0; |
|
216 |
select * from t2; |
|
217 |
p i a |
|
218 |
1001 2 qqqq |
|
219 |
2 2 pppp |
|
220 |
3 2 yyyy |
|
221 |
4000 3 zzzz |
|
222 |
2000 3 yyyy |
|
223 |
select p from t2; |
|
224 |
p
|
|
225 |
2
|
|
226 |
3
|
|
227 |
1001
|
|
228 |
2000
|
|
229 |
4000
|
|
230 |
explain select i from t2; |
|
231 |
id select_type table type possible_keys key key_len ref rows Extra |
|
232 |
1 SIMPLE t2 index NULL k1 5 NULL 5 Using index |
|
233 |
select i from t2; |
|
234 |
i
|
|
235 |
2
|
|
236 |
2
|
|
237 |
2
|
|
238 |
3
|
|
239 |
3
|
|
240 |
explain select a from t2; |
|
241 |
id select_type table type possible_keys key key_len ref rows Extra |
|
766
by Brian Aker
Fixed key_cache test |
242 |
1 SIMPLE t2 index NULL k2 43 NULL 5 Using index |
1
by brian
clean slate |
243 |
select a from t2; |
244 |
a
|
|
245 |
pppp
|
|
246 |
qqqq
|
|
247 |
yyyy
|
|
248 |
yyyy
|
|
249 |
zzzz
|
|
250 |
select * from t1; |
|
251 |
p a |
|
252 |
3 qqqq |
|
253 |
12 yyyy |
|
254 |
select p from t1; |
|
255 |
p
|
|
256 |
3
|
|
257 |
12
|
|
258 |
create table t3 (like t1); |
|
259 |
cache index t3 in small; |
|
260 |
Table Op Msg_type Msg_text |
|
261 |
test.t3 assign_to_keycache status OK |
|
262 |
insert into t3 select * from t1; |
|
263 |
cache index t3 in keycache2; |
|
264 |
Table Op Msg_type Msg_text |
|
265 |
test.t3 assign_to_keycache status OK |
|
266 |
cache index t1,t2 in default; |
|
267 |
Table Op Msg_type Msg_text |
|
268 |
test.t1 assign_to_keycache status OK |
|
269 |
test.t2 assign_to_keycache status OK |
|
270 |
drop table t1,t2,t3; |
|
271 |
show status like 'key_blocks_used'; |
|
272 |
Variable_name Value |
|
273 |
Key_blocks_used 4 |
|
274 |
show status like 'key_blocks_unused'; |
|
275 |
Variable_name Value |
|
766
by Brian Aker
Fixed key_cache test |
276 |
Key_blocks_unused 837 |
1
by brian
clean slate |
277 |
set global keycache2.key_buffer_size=0; |
278 |
set global keycache3.key_buffer_size=100; |
|
279 |
Warnings: |
|
280 |
Warning 1292 Truncated incorrect key_buffer_size value: '100' |
|
281 |
set global keycache3.key_buffer_size=0; |
|
282 |
set global key_cache_block_size= @my_key_cache_block_size; |
|
766
by Brian Aker
Fixed key_cache test |
283 |
ERROR 42000: Incorrect argument type to variable 'key_cache_block_size' |
284 |
CREATE TABLE t1(a int NOT NULL AUTO_INCREMENT PRIMARY KEY) ENGINE=MYISAM; |
|
1
by brian
clean slate |
285 |
SET @my_key_cache_block_size= @@global.key_cache_block_size; |
286 |
SET GLOBAL key_cache_block_size=1536; |
|
287 |
INSERT INTO t1 VALUES (1); |
|
288 |
SELECT @@key_cache_block_size; |
|
289 |
@@key_cache_block_size
|
|
290 |
1536
|
|
291 |
CHECK TABLE t1; |
|
292 |
Table Op Msg_type Msg_text |
|
293 |
test.t1 check status OK |
|
294 |
DROP TABLE t1; |
|
766
by Brian Aker
Fixed key_cache test |
295 |
CREATE TABLE t1(a int NOT NULL AUTO_INCREMENT PRIMARY KEY, b int) ENGINE=MYISAM; |
296 |
CREATE TABLE t2(a int NOT NULL AUTO_INCREMENT PRIMARY KEY, b int) ENGINE=MYISAM; |
|
1
by brian
clean slate |
297 |
SET GLOBAL key_cache_block_size=1536; |
298 |
INSERT INTO t1 VALUES (1,0); |
|
299 |
INSERT INTO t2(b) SELECT b FROM t1; |
|
300 |
INSERT INTO t1(b) SELECT b FROM t2; |
|
301 |
INSERT INTO t2(b) SELECT b FROM t1; |
|
302 |
INSERT INTO t1(b) SELECT b FROM t2; |
|
303 |
INSERT INTO t2(b) SELECT b FROM t1; |
|
304 |
INSERT INTO t1(b) SELECT b FROM t2; |
|
305 |
INSERT INTO t2(b) SELECT b FROM t1; |
|
306 |
INSERT INTO t1(b) SELECT b FROM t2; |
|
307 |
INSERT INTO t2(b) SELECT b FROM t1; |
|
308 |
INSERT INTO t1(b) SELECT b FROM t2; |
|
309 |
INSERT INTO t2(b) SELECT b FROM t1; |
|
310 |
INSERT INTO t1(b) SELECT b FROM t2; |
|
311 |
INSERT INTO t2(b) SELECT b FROM t1; |
|
312 |
INSERT INTO t1(b) SELECT b FROM t2; |
|
313 |
INSERT INTO t2(b) SELECT b FROM t1; |
|
314 |
INSERT INTO t1(b) SELECT b FROM t2; |
|
315 |
INSERT INTO t2(b) SELECT b FROM t1; |
|
316 |
INSERT INTO t1(b) SELECT b FROM t2; |
|
317 |
SELECT COUNT(*) FROM t1; |
|
318 |
COUNT(*) |
|
319 |
4181
|
|
320 |
SELECT @@key_cache_block_size; |
|
321 |
@@key_cache_block_size
|
|
322 |
1536
|
|
323 |
CHECK TABLE t1; |
|
324 |
Table Op Msg_type Msg_text |
|
325 |
test.t1 check status OK |
|
326 |
DROP TABLE t1,t2; |
|
327 |
set global key_cache_block_size= @my_key_cache_block_size; |
|
328 |
set @@global.key_buffer_size=0; |
|
329 |
Warnings: |
|
330 |
Warning 1438 Cannot drop default keycache |
|
331 |
select @@global.key_buffer_size; |
|
332 |
@@global.key_buffer_size
|
|
766
by Brian Aker
Fixed key_cache test |
333 |
1048576
|
1
by brian
clean slate |
334 |
SET @bug28478_key_cache_block_size= @@global.key_cache_block_size; |
335 |
SET GLOBAL key_cache_block_size= 1536; |
|
336 |
CREATE TABLE t1 ( |
|
337 |
id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY, |
|
766
by Brian Aker
Fixed key_cache test |
338 |
c1 CHAR(50), |
339 |
c2 CHAR(50), |
|
340 |
c3 CHAR(50), |
|
1
by brian
clean slate |
341 |
KEY(c1, c2, c3) |
342 |
) ENGINE= MyISAM; |
|
343 |
INSERT INTO t1 (c1, c2, c3) VALUES |
|
344 |
('a', 'b', 'c'), ('b', 'c', 'd'), ('c', 'd', 'e'), ('d', 'e', 'f'), |
|
345 |
('e', 'f', 'g'), ('f', 'g', 'h'), ('g', 'h', 'i'), ('h', 'i', 'j'), |
|
346 |
('i', 'j', 'k'), ('j', 'k', 'l'), ('k', 'l', 'm'), ('l', 'm', 'n'), |
|
347 |
('m', 'n', 'o'), ('n', 'o', 'p'), ('o', 'p', 'q'), ('p', 'q', 'r'), |
|
348 |
('q', 'r', 's'), ('r', 's', 't'), ('s', 't', 'u'), ('t', 'u', 'v'), |
|
349 |
('u', 'v', 'w'), ('v', 'w', 'x'), ('w', 'x', 'y'), ('x', 'y', 'z'); |
|
350 |
INSERT INTO t1 (c1, c2, c3) SELECT c1, c2, c3 from t1; |
|
351 |
INSERT INTO t1 (c1, c2, c3) SELECT c1, c2, c3 from t1; |
|
352 |
INSERT INTO t1 (c1, c2, c3) SELECT c1, c2, c3 from t1; |
|
353 |
CHECK TABLE t1; |
|
354 |
Table Op Msg_type Msg_text |
|
355 |
test.t1 check status OK |
|
356 |
SHOW VARIABLES LIKE 'key_cache_block_size'; |
|
357 |
Variable_name Value |
|
358 |
key_cache_block_size 1536 |
|
359 |
SET GLOBAL key_cache_block_size= @bug28478_key_cache_block_size; |
|
360 |
DROP TABLE t1; |