~jlukas79/+junk/mysql-server

« back to all changes in this revision

Viewing changes to mysql-test/r/partition.result

manual merge 6.0-main --> 6.0-bka-review

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
drop table if exists t1;
 
1
drop table if exists t1, t2;
 
2
CREATE TABLE t1 (
 
3
a INT NOT NULL,   
 
4
b MEDIUMINT NOT NULL,   
 
5
c INT NOT NULL,
 
6
KEY b (b)
 
7
) ENGINE=MyISAM
 
8
PARTITION BY LIST (a) (
 
9
PARTITION p0 VALUES IN (1) 
 
10
);
 
11
INSERT INTO t1 VALUES (1,1,0), (1,1,1), (1,1,2), (1,1,53), (1,1,4), (1,1,5),
 
12
(1,1,6), (1,1,7), (1,1,8), (1,1,9), (1,1,10), (1,1,11), (1,1,12), (1,1,13),
 
13
(1,1,14), (1,1,15), (1,1,16), (1,1,67), (1,1,18), (1,1,19), (1,1,20), (1,1,21),
 
14
(1,1,22), (1,1,23), (1,1,24), (1,1,75), (1,1,26), (1,1,27), (1,1,128),
 
15
(1,1,79), (1,1,30), (1,1,31), (1,1,32), (1,1,33), (1,1,34), (1,1,85), (1,1,36),
 
16
(1,1,37), (1,1,38), (1,1,39), (1,1,40), (1,1,241), (1,1,42), (1,1,43),
 
17
(1,1,44), (1,1,45), (1,1,46), (1,1,147), (1,1,48), (1,1,49), (1,2,0), (1,2,1),
 
18
(1,2,2), (1,2,3), (1,2,4), (1,2,5), (1,2,6), (1,2,7), (1,2,8), (1,2,9),
 
19
(1,2,10), (1,2,11), (1,2,12), (1,2,13), (1,2,14), (1,2,15), (1,2,16), (1,2,17),
 
20
(1,2,18), (1,2,19), (1,2,20), (1,2,21), (1,2,22), (1,2,23), (1,2,24), (1,2,25),
 
21
(1,2,26), (1,2,27), (1,2,28), (1,2,29), (1,2,30), (1,2,31), (1,2,32), (1,2,33),
 
22
(1,2,34), (1,2,35), (1,2,36), (1,2,37), (1,2,38), (1,2,39), (1,2,40), (1,2,41),
 
23
(1,2,42), (1,2,43), (1,2,44), (1,2,45), (1,2,46), (1,2,47), (1,2,48), (1,2,49),
 
24
(1,6,0), (1,6,1), (1,6,2), (1,6,3), (1,6,4), (1,6,5), (1,6,6), (1,6,7),
 
25
(1,6,8), (1,6,9), (1,6,10), (1,6,11), (1,6,12), (1,6,13), (1,6,14), (1,6,15),
 
26
(1,6,16), (1,6,17), (1,6,18), (1,6,19), (1,6,20), (1,6,21), (1,6,22), (1,6,23),
 
27
(1,6,24), (1,6,25), (1,6,26), (1,6,27), (1,6,28), (1,6,29), (1,6,30), (1,6,31),
 
28
(1,6,32), (1,6,33), (1,6,34), (1,6,35), (1,6,36), (1,6,37), (1,6,38), (1,6,39),
 
29
(1,6,40), (1,6,41), (1,6,42), (1,6,43), (1,6,44), (1,6,45), (1,6,46), (1,6,47),
 
30
(1,6,48), (1,6,49), (1,7,0), (1,7,1), (1,7,2), (1,7,3), (1,7,4), (1,7,5),
 
31
(1,7,6), (1,7,7), (1,7,8), (1,7,9), (1,7,10), (1,7,11), (1,7,12), (1,7,13),
 
32
(1,7,14), (1,7,15), (1,7,16), (1,7,17), (1,7,18), (1,7,19), (1,7,20), (1,7,21),
 
33
(1,7,22), (1,7,23), (1,7,24), (1,7,25), (1,7,26), (1,7,27), (1,7,28), (1,7,29),
 
34
(1,7,30), (1,7,31), (1,7,32), (1,7,33), (1,7,34), (1,7,35), (1,7,38), (1,7,39),
 
35
(1,7,90), (1,7,41), (1,7,43), (1,7,48), (1,7,49), (1,9,0), (1,9,1), (1,9,2),
 
36
(1,9,3), (1,9,4), (1,9,5), (1,9,6), (1,9,7), (1,9,8), (1,9,9), (1,9,10),
 
37
(1,9,11), (1,9,12), (1,9,13), (1,9,14), (1,9,15), (1,9,16), (1,9,17), (1,9,18),
 
38
(1,9,19), (1,9,20), (1,9,21), (1,9,22), (1,9,23), (1,9,24), (1,9,25), (1,9,26),
 
39
(1,9,29), (1,9,32), (1,9,35), (1,9,38), (1,10,0), (1,10,1), (1,10,2), (1,10,3),
 
40
(1,10,4), (1,10,5), (1,10,6), (1,10,7), (1,10,8), (1,10,9), (1,10,10),
 
41
(1,10,11), (1,10,13), (1,10,14), (1,10,15), (1,10,16), (1,10,17), (1,10,18),
 
42
(1,10,22), (1,10,24), (1,10,25), (1,10,26), (1,10,28), (1,10,131), (1,10,33),
 
43
(1,10,84), (1,10,35), (1,10,40), (1,10,42), (1,10,49), (1,11,0), (1,11,1),
 
44
(1,11,2), (1,11,3), (1,11,4), (1,11,5), (1,11,6), (1,11,7), (1,11,8), (1,11,9),
 
45
(1,11,10), (1,11,11), (1,11,12), (1,11,13), (1,11,14), (1,11,15), (1,11,16),
 
46
(1,11,17), (1,11,18), (1,11,19), (1,11,20), (1,11,21), (1,11,22), (1,11,23),
 
47
(1,11,24), (1,11,25), (1,11,26), (1,11,27), (1,11,28), (1,11,30), (1,11,31),
 
48
(1,11,32), (1,11,33), (1,11,34), (1,11,35), (1,11,37), (1,11,39), (1,11,40),
 
49
(1,11,42), (1,11,44), (1,11,45), (1,11,47), (1,11,48), (1,14,104), (1,14,58),
 
50
(1,14,12), (1,14,13), (1,14,15), (1,14,16), (1,14,17), (1,14,34), (1,15,0),
 
51
(1,15,1), (1,15,2), (1,15,3), (1,15,4), (1,15,5), (1,15,7), (1,15,9),
 
52
(1,15,15), (1,15,27), (1,15,49), (1,16,0), (1,16,1), (1,16,3), (1,17,4),
 
53
(1,19,1);
 
54
SELECT COUNT(*) FROM t1 WHERE b NOT IN ( 1,2,6,7,9,10,11 );
 
55
COUNT(*)
 
56
24
 
57
SELECT SUM(c) FROM t1 WHERE b NOT IN ( 1,2,6,7,9,10,11 );
 
58
SUM(c)
 
59
400
 
60
ALTER TABLE t1 DROP INDEX b;
 
61
SELECT COUNT(*) FROM t1 WHERE b NOT IN ( 1,2,6,7,9,10,11 );
 
62
COUNT(*)
 
63
24
 
64
SELECT SUM(c) FROM t1 WHERE b NOT IN ( 1,2,6,7,9,10,11 );
 
65
SUM(c)
 
66
400
 
67
ALTER TABLE t1 ENGINE = Memory;
 
68
SELECT COUNT(*) FROM t1 WHERE b NOT IN ( 1,2,6,7,9,10,11 );
 
69
COUNT(*)
 
70
24
 
71
SELECT SUM(c) FROM t1 WHERE b NOT IN ( 1,2,6,7,9,10,11 );
 
72
SUM(c)
 
73
400
 
74
ALTER TABLE t1 ADD INDEX b USING HASH (b);
 
75
SELECT COUNT(*) FROM t1 WHERE b NOT IN ( 1,2,6,7,9,10,11 );
 
76
COUNT(*)
 
77
24
 
78
SELECT SUM(c) FROM t1 WHERE b NOT IN ( 1,2,6,7,9,10,11 );
 
79
SUM(c)
 
80
400
 
81
DROP TABLE t1;
 
82
CREATE TABLE `t1` (
 
83
`c1` int(11) DEFAULT NULL,
 
84
KEY `c1` (`c1`)
 
85
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
 
86
CREATE TABLE `t2` (
 
87
`c1` int(11) DEFAULT NULL,
 
88
KEY `c1` (`c1`)
 
89
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (c1) (PARTITION a VALUES LESS THAN (100) ENGINE = MyISAM, PARTITION b VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */;
 
90
INSERT INTO `t1` VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13),(14),(15),(16),(17),(18),(19),(20);
 
91
INSERT INTO `t2` VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13),(14),(15),(16),(17),(18),(19),(20);
 
92
EXPLAIN PARTITIONS SELECT c1 FROM t1 WHERE (c1 > 10 AND c1 < 13) OR (c1 > 17 AND c1 < 20);
 
93
id      select_type     table   partitions      type    possible_keys   key     key_len ref     rows    Extra
 
94
1       SIMPLE  t1      NULL    range   c1      c1      5       NULL    4       Using where; Using index
 
95
FLUSH STATUS;
 
96
SELECT c1 FROM t1 WHERE (c1 > 10 AND c1 < 13) OR (c1 > 17 AND c1 < 20);
 
97
c1
 
98
11
 
99
12
 
100
18
 
101
19
 
102
SHOW STATUS LIKE 'Handler_read_%';
 
103
Variable_name   Value
 
104
Handler_read_first      0
 
105
Handler_read_key        2
 
106
Handler_read_next       4
 
107
Handler_read_prev       0
 
108
Handler_read_rnd        0
 
109
Handler_read_rnd_next   0
 
110
EXPLAIN PARTITIONS SELECT c1 FROM t2 WHERE (c1 > 10 AND c1 < 13) OR (c1 > 17 AND c1 < 20);
 
111
id      select_type     table   partitions      type    possible_keys   key     key_len ref     rows    Extra
 
112
1       SIMPLE  t2      a       range   c1      c1      5       NULL    4       Using where; Using index
 
113
FLUSH STATUS;
 
114
SELECT c1 FROM t2 WHERE (c1 > 10 AND c1 < 13) OR (c1 > 17 AND c1 < 20);
 
115
c1
 
116
11
 
117
12
 
118
18
 
119
19
 
120
SHOW STATUS LIKE 'Handler_read_%';
 
121
Variable_name   Value
 
122
Handler_read_first      0
 
123
Handler_read_key        2
 
124
Handler_read_next       4
 
125
Handler_read_prev       0
 
126
Handler_read_rnd        0
 
127
Handler_read_rnd_next   0
 
128
DROP TABLE t1,t2;
 
129
CREATE TABLE `t1` (
 
130
`c1` int(11) DEFAULT NULL,
 
131
KEY `c1` (`c1`)
 
132
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
 
133
CREATE TABLE `t2` (
 
134
`c1` int(11) DEFAULT NULL,
 
135
KEY `c1` (`c1`)
 
136
) ENGINE=MyISAM DEFAULT CHARSET=latin1 /*!50100 PARTITION BY RANGE (c1) (PARTITION a VALUES LESS THAN (100) ENGINE = MyISAM, PARTITION b VALUES LESS THAN MAXVALUE ENGINE = MyISAM) */;
 
137
INSERT INTO `t1` VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13),(14),(15),(16),(17),(18),(19),(20);
 
138
INSERT INTO `t2` VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13),(14),(15),(16),(17),(18),(19),(20);
 
139
EXPLAIN PARTITIONS SELECT c1 FROM t1 WHERE (c1 > 2 AND c1 < 5);
 
140
id      select_type     table   partitions      type    possible_keys   key     key_len ref     rows    Extra
 
141
1       SIMPLE  t1      NULL    range   c1      c1      5       NULL    2       Using where; Using index
 
142
FLUSH STATUS;
 
143
SELECT c1 FROM t1 WHERE (c1 > 2 AND c1 < 5);
 
144
c1
 
145
3
 
146
4
 
147
SHOW STATUS LIKE 'Handler_read_%';
 
148
Variable_name   Value
 
149
Handler_read_first      0
 
150
Handler_read_key        1
 
151
Handler_read_next       2
 
152
Handler_read_prev       0
 
153
Handler_read_rnd        0
 
154
Handler_read_rnd_next   0
 
155
EXPLAIN PARTITIONS SELECT c1 FROM t2 WHERE (c1 > 2 AND c1 < 5);
 
156
id      select_type     table   partitions      type    possible_keys   key     key_len ref     rows    Extra
 
157
1       SIMPLE  t2      a       range   c1      c1      5       NULL    2       Using where; Using index
 
158
FLUSH STATUS;
 
159
SELECT c1 FROM t2 WHERE (c1 > 2 AND c1 < 5);
 
160
c1
 
161
3
 
162
4
 
163
SHOW STATUS LIKE 'Handler_read_%';
 
164
Variable_name   Value
 
165
Handler_read_first      0
 
166
Handler_read_key        1
 
167
Handler_read_next       2
 
168
Handler_read_prev       0
 
169
Handler_read_rnd        0
 
170
Handler_read_rnd_next   0
 
171
EXPLAIN PARTITIONS SELECT c1 FROM t1 WHERE (c1 > 12 AND c1 < 15);
 
172
id      select_type     table   partitions      type    possible_keys   key     key_len ref     rows    Extra
 
173
1       SIMPLE  t1      NULL    range   c1      c1      5       NULL    2       Using where; Using index
 
174
FLUSH STATUS;
 
175
SELECT c1 FROM t1 WHERE (c1 > 12 AND c1 < 15);
 
176
c1
 
177
13
 
178
14
 
179
SHOW STATUS LIKE 'Handler_read_%';
 
180
Variable_name   Value
 
181
Handler_read_first      0
 
182
Handler_read_key        1
 
183
Handler_read_next       2
 
184
Handler_read_prev       0
 
185
Handler_read_rnd        0
 
186
Handler_read_rnd_next   0
 
187
EXPLAIN PARTITIONS SELECT c1 FROM t2 WHERE (c1 > 12 AND c1 < 15);
 
188
id      select_type     table   partitions      type    possible_keys   key     key_len ref     rows    Extra
 
189
1       SIMPLE  t2      a       range   c1      c1      5       NULL    2       Using where; Using index
 
190
FLUSH STATUS;
 
191
SELECT c1 FROM t2 WHERE (c1 > 12 AND c1 < 15);
 
192
c1
 
193
13
 
194
14
 
195
SHOW STATUS LIKE 'Handler_read_%';
 
196
Variable_name   Value
 
197
Handler_read_first      0
 
198
Handler_read_key        1
 
199
Handler_read_next       2
 
200
Handler_read_prev       0
 
201
Handler_read_rnd        0
 
202
Handler_read_rnd_next   0
 
203
DROP TABLE t1,t2;
2
204
create table t1 (a int) partition by list ((a/3)*10 div 1)
3
205
(partition p0 values in (0), partition p1 values in (1));
4
206
ERROR HY000: This partition function is not allowed
945
1147
2
946
1148
explain partitions select * from t1 where a is null or a < 0 or a > 1;
947
1149
id      select_type     table   partitions      type    possible_keys   key     key_len ref     rows    Extra
948
 
1       SIMPLE  t1      pn,p2   ALL     NULL    NULL    NULL    NULL    2       Using where
 
1150
1       SIMPLE  t1      pn,p2   ALL     NULL    NULL    NULL    NULL    4       Using where
949
1151
drop table t1;
950
1152
CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY, name VARCHAR(20)) 
951
1153
ENGINE=MyISAM DEFAULT CHARSET=latin1