1drop table if exists t1, t2;
2create table t1 (
3a int not null auto_increment,
4b char(16) not null,
5primary key (a),
6key (b)
7);
8create table t2(
9a int not null auto_increment,
10b char(16) not null,
11primary key (a),
12key (b)
13);
14insert into t1(b) values
15('test0'),
16('test1'),
17('test2'),
18('test3'),
19('test4'),
20('test5'),
21('test6'),
22('test7');
23insert into t2(b) select b from t1;
24insert into t1(b) select b from t2;
25insert into t2(b) select b from t1;
26insert into t1(b) select b from t2;
27insert into t2(b) select b from t1;
28insert into t1(b) select b from t2;
29insert into t2(b) select b from t1;
30insert into t1(b) select b from t2;
31insert into t2(b) select b from t1;
32insert into t1(b) select b from t2;
33insert into t2(b) select b from t1;
34insert into t1(b) select b from t2;
35insert into t2(b) select b from t1;
36insert into t1(b) select b from t2;
37insert into t2(b) select b from t1;
38insert into t1(b) select b from t2;
39insert into t2(b) select b from t1;
40insert into t1(b) select b from t2;
41select count(*) from t1;
42count(*)
4333448
44select count(*) from t2;
45count(*)
4620672
47flush tables;
48flush status;
49show status like "key_read%";
50Variable_name	Value
51Key_read_requests	0
52Key_reads	0
53select count(*) from t1 where b = 'test1';
54count(*)
554181
56show status like "key_read%";
57Variable_name	Value
58Key_read_requests	294
59Key_reads	60
60select count(*) from t1 where b = 'test1';
61count(*)
624181
63show status like "key_read%";
64Variable_name	Value
65Key_read_requests	588
66Key_reads	60
67flush tables;
68flush status;
69select @@preload_buffer_size;
70@@preload_buffer_size
7132768
72load index into cache t1;
73Table	Op	Msg_type	Msg_text
74test.t1	preload_keys	status	OK
75show status like "key_read%";
76Variable_name	Value
77Key_read_requests	774
78Key_reads	774
79select count(*) from t1 where b = 'test1';
80count(*)
814181
82show status like "key_read%";
83Variable_name	Value
84Key_read_requests	1068
85Key_reads	774
86flush tables;
87flush status;
88show status like "key_read%";
89Variable_name	Value
90Key_read_requests	0
91Key_reads	0
92set session preload_buffer_size=256*1024;
93select @@preload_buffer_size;
94@@preload_buffer_size
95262144
96load index into cache t1 ignore leaves;
97Table	Op	Msg_type	Msg_text
98test.t1	preload_keys	status	OK
99show status like "key_read%";
100Variable_name	Value
101Key_read_requests	17
102Key_reads	17
103select count(*) from t1 where b = 'test1';
104count(*)
1054181
106show status like "key_read%";
107Variable_name	Value
108Key_read_requests	311
109Key_reads	75
110flush tables;
111flush status;
112show status like "key_read%";
113Variable_name	Value
114Key_read_requests	0
115Key_reads	0
116set session preload_buffer_size=1*1024;
117select @@preload_buffer_size;
118@@preload_buffer_size
1191024
120load index into cache t1, t2 key (primary,b) ignore leaves;
121Table	Op	Msg_type	Msg_text
122test.t1	preload_keys	status	OK
123test.t2	preload_keys	status	OK
124show status like "key_read%";
125Variable_name	Value
126Key_read_requests	785
127Key_reads	785
128select count(*) from t1 where b = 'test1';
129count(*)
1304181
131select count(*) from t2 where b = 'test1';
132count(*)
1332584
134show status like "key_read%";
135Variable_name	Value
136Key_read_requests	1266
137Key_reads	821
138flush tables;
139flush status;
140show status like "key_read%";
141Variable_name	Value
142Key_read_requests	0
143Key_reads	0
144load index into cache t3, t2 key (primary,b) ;
145Table	Op	Msg_type	Msg_text
146test.t3	preload_keys	Error	Table 'test.t3' doesn't exist
147test.t3	preload_keys	status	Operation failed
148test.t2	preload_keys	status	OK
149show status like "key_read%";
150Variable_name	Value
151Key_read_requests	478
152Key_reads	478
153flush tables;
154flush status;
155show status like "key_read%";
156Variable_name	Value
157Key_read_requests	0
158Key_reads	0
159load index into cache t3 key (b), t2 key (c) ;
160Table	Op	Msg_type	Msg_text
161test.t3	preload_keys	Error	Table 'test.t3' doesn't exist
162test.t3	preload_keys	status	Operation failed
163test.t2	preload_keys	Error	Key 'c' doesn't exist in table 't2'
164test.t2	preload_keys	status	Operation failed
165show status like "key_read%";
166Variable_name	Value
167Key_read_requests	0
168Key_reads	0
169drop table t1, t2;
170