summaryrefslogtreecommitdiff
path: root/mysql-test/r/partition_cache.result
blob: cd579d00952d2413873153485610571cb2fbcd84 (plain)
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
SET SESSION STORAGE_ENGINE = InnoDB;
drop table if exists t1,t2,t3;
set @save_query_cache_size = @@global.query_cache_size;
set GLOBAL query_cache_size = 1355776;
flush status;
set autocommit=0;
create table t1 (a int not null) PARTITION BY KEY (a) PARTITIONS 3;
insert into t1 values (1),(2),(3);
select * from t1;
a
1
2
3
show status like "Qcache_queries_in_cache";
Variable_name	Value
Qcache_queries_in_cache	0
drop table t1;
commit;
set autocommit=1;
begin;
create table t1 (a int not null) PARTITION BY KEY (a) PARTITIONS 3;
insert into t1 values (1),(2),(3);
select * from t1;
a
1
2
3
show status like "Qcache_queries_in_cache";
Variable_name	Value
Qcache_queries_in_cache	1
drop table t1;
commit;
create table t1 (a int not null) PARTITION BY KEY (a) PARTITIONS 3;
create table t2 (a int not null) PARTITION BY KEY (a) PARTITIONS 3;
create table t3 (a int not null) PARTITION BY KEY (a) PARTITIONS 3;
insert into t1 values (1),(2);
insert into t2 values (1),(2);
insert into t3 values (1),(2);
select * from t1;
a
1
2
select * from t2;
a
1
2
select * from t3;
a
1
2
show status like "Qcache_queries_in_cache";
Variable_name	Value
Qcache_queries_in_cache	3
show status like "Qcache_hits";
Variable_name	Value
Qcache_hits	0
begin;
select * from t1;
a
1
2
select * from t2;
a
1
2
select * from t3;
a
1
2
show status like "Qcache_queries_in_cache";
Variable_name	Value
Qcache_queries_in_cache	6
show status like "Qcache_hits";
Variable_name	Value
Qcache_hits	0
insert into t1 values (3);
insert into t2 values (3);
insert into t1 values (4);
select * from t1;
a
1
2
3
4
select * from t2;
a
1
2
3
select * from t3;
a
1
2
show status like "Qcache_queries_in_cache";
Variable_name	Value
Qcache_queries_in_cache	2
show status like "Qcache_hits";
Variable_name	Value
Qcache_hits	1
commit;
show status like "Qcache_queries_in_cache";
Variable_name	Value
Qcache_queries_in_cache	2
drop table t3,t2,t1;
CREATE TABLE t1 (id int(11) NOT NULL auto_increment, PRIMARY KEY (id)) PARTITION BY HASH (id) PARTITIONS 3;
select count(*) from t1;
count(*)
0
insert into t1 (id) values (0);
select count(*) from t1;
count(*)
1
drop table t1;
SET SESSION STORAGE_ENGINE = InnoDB;
SET @@autocommit=1;
connection default
SHOW VARIABLES LIKE 'have_query_cache';
Variable_name	Value
have_query_cache	YES
SET GLOBAL query_cache_size = 204800;
flush status;
SET @@autocommit=1;
SET SESSION STORAGE_ENGINE = InnoDB;
CREATE TABLE t2 (s1 int, s2 varchar(1000), key(s1)) PARTITION BY KEY (s1) PARTITIONS 3;
INSERT INTO t2 VALUES (1,repeat('a',10)),(2,repeat('a',10)),(3,repeat('a',10)),(4,repeat('a',10));
COMMIT;
START TRANSACTION;
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
count(*)
0
UPDATE t2 SET s2 = 'w' WHERE s1 = 3;
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
count(*)
1
show status like "Qcache_queries_in_cache";
Variable_name	Value
Qcache_queries_in_cache	0
connection connection1
START TRANSACTION;
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
count(*)
0
INSERT INTO t2 VALUES (5,'w');
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
count(*)
1
COMMIT;
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
count(*)
1
show status like "Qcache_queries_in_cache";
Variable_name	Value
Qcache_queries_in_cache	0
connection default
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
count(*)
1
COMMIT;
show status like "Qcache_queries_in_cache";
Variable_name	Value
Qcache_queries_in_cache	0
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
count(*)
2
show status like "Qcache_queries_in_cache";
Variable_name	Value
Qcache_queries_in_cache	1
connection connection1
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
count(*)
2
START TRANSACTION;
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
count(*)
2
INSERT INTO t2 VALUES (6,'w');
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
count(*)
3
connection default
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
count(*)
2
START TRANSACTION;
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
count(*)
2
DELETE from t2 WHERE s1=3;
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
count(*)
1
COMMIT;
connection connection1
COMMIT;
SELECT sql_cache count(*) FROM t2 WHERE s2 = 'w';
count(*)
2
show status like "Qcache_queries_in_cache";
Variable_name	Value
Qcache_queries_in_cache	1
show status like "Qcache_hits";
Variable_name	Value
Qcache_hits	1
set @@global.query_cache_size = @save_query_cache_size;
drop table t2;