~ubuntu-branches/ubuntu/precise/mysql-5.1/precise

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Norbert Tretkowski
  • Date: 2010-03-17 14:56:02 UTC
  • Revision ID: james.westby@ubuntu.com-20100317145602-x7e30l1b2sb5s6w6
Tags: upstream-5.1.45
ImportĀ upstreamĀ versionĀ 5.1.45

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
drop table if exists t1;
 
2
CREATE TABLE t1 (c1 INT)
 
3
PARTITION BY HASH (c1)
 
4
PARTITIONS 15;
 
5
INSERT INTO t1 VALUES (1), (2), (3), (4), (5);
 
6
ALTER TABLE t1 COALESCE PARTITION 13;
 
7
DROP TABLE t1;
 
8
CREATE TABLE t1 (c1 INT)
 
9
PARTITION BY LINEAR HASH (c1)
 
10
PARTITIONS 5;
 
11
INSERT INTO t1 VALUES (1), (2), (3), (4), (5);
 
12
ALTER TABLE t1 COALESCE PARTITION 3;
 
13
DROP TABLE t1;
 
14
create table t1 (a int unsigned)
 
15
partition by hash(a div 2)
 
16
partitions 4;
 
17
insert into t1 values (null),(0),(1),(2),(3),(4),(5),(6),(7);
 
18
select * from t1 where a < 0;
 
19
a
 
20
select * from t1 where a is null or (a >= 5 and a <= 7);
 
21
a
 
22
NULL
 
23
5
 
24
6
 
25
7
 
26
select * from t1 where a is null;
 
27
a
 
28
NULL
 
29
select * from t1 where a is not null;
 
30
a
 
31
0
 
32
1
 
33
2
 
34
3
 
35
4
 
36
5
 
37
6
 
38
7
 
39
select * from t1 where a >= 1 and a < 3;
 
40
a
 
41
1
 
42
2
 
43
select * from t1 where a >= 3 and a <= 5;
 
44
a
 
45
3
 
46
4
 
47
5
 
48
select * from t1 where a > 2 and a < 4;
 
49
a
 
50
3
 
51
select * from t1 where a > 3 and a <= 6;
 
52
a
 
53
4
 
54
5
 
55
6
 
56
select * from t1 where a > 5;
 
57
a
 
58
6
 
59
7
 
60
select * from t1 where a >= 1 and a <= 5;
 
61
a
 
62
1
 
63
2
 
64
3
 
65
4
 
66
5
 
67
explain partitions select * from t1 where a < 0;
 
68
id      select_type     table   partitions      type    possible_keys   key     key_len ref     rows    Extra
 
69
1       SIMPLE  t1      p0,p1,p2,p3     ALL     NULL    NULL    NULL    NULL    9       Using where
 
70
explain partitions select * from t1 where a is null or (a >= 5 and a <= 7);
 
71
id      select_type     table   partitions      type    possible_keys   key     key_len ref     rows    Extra
 
72
1       SIMPLE  t1      p0,p2,p3        ALL     NULL    NULL    NULL    NULL    9       Using where
 
73
explain partitions select * from t1 where a is null;
 
74
id      select_type     table   partitions      type    possible_keys   key     key_len ref     rows    Extra
 
75
1       SIMPLE  t1      p0      ALL     NULL    NULL    NULL    NULL    9       Using where
 
76
explain partitions select * from t1 where a is not null;
 
77
id      select_type     table   partitions      type    possible_keys   key     key_len ref     rows    Extra
 
78
1       SIMPLE  t1      p0,p1,p2,p3     ALL     NULL    NULL    NULL    NULL    9       Using where
 
79
explain partitions select * from t1 where a >= 1 and a < 3;
 
80
id      select_type     table   partitions      type    possible_keys   key     key_len ref     rows    Extra
 
81
1       SIMPLE  t1      p0,p1   ALL     NULL    NULL    NULL    NULL    9       Using where
 
82
explain partitions select * from t1 where a >= 3 and a <= 5;
 
83
id      select_type     table   partitions      type    possible_keys   key     key_len ref     rows    Extra
 
84
1       SIMPLE  t1      p1,p2   ALL     NULL    NULL    NULL    NULL    9       Using where
 
85
explain partitions select * from t1 where a > 2 and a < 4;
 
86
id      select_type     table   partitions      type    possible_keys   key     key_len ref     rows    Extra
 
87
1       SIMPLE  t1      p1      ALL     NULL    NULL    NULL    NULL    9       Using where
 
88
explain partitions select * from t1 where a > 3 and a <= 6;
 
89
id      select_type     table   partitions      type    possible_keys   key     key_len ref     rows    Extra
 
90
1       SIMPLE  t1      p2,p3   ALL     NULL    NULL    NULL    NULL    9       Using where
 
91
explain partitions select * from t1 where a > 5;
 
92
id      select_type     table   partitions      type    possible_keys   key     key_len ref     rows    Extra
 
93
1       SIMPLE  t1      p0,p1,p2,p3     ALL     NULL    NULL    NULL    NULL    9       Using where
 
94
explain partitions select * from t1 where a >= 1 and a <= 5;
 
95
id      select_type     table   partitions      type    possible_keys   key     key_len ref     rows    Extra
 
96
1       SIMPLE  t1      p0,p1,p2,p3     ALL     NULL    NULL    NULL    NULL    9       Using where
 
97
drop table t1;
 
98
CREATE TABLE t1 (
 
99
a int not null,
 
100
b int not null,
 
101
c int not null,
 
102
primary key(a,b))
 
103
partition by hash (a + 2)
 
104
partitions 3
 
105
(partition x1 tablespace ts1,
 
106
partition x2 tablespace ts2,
 
107
partition x3 tablespace ts3);
 
108
insert into t1 values (1,1,1);
 
109
insert into t1 values (2,1,1);
 
110
insert into t1 values (3,1,1);
 
111
insert into t1 values (4,1,1);
 
112
insert into t1 values (5,1,1);
 
113
select * from t1;
 
114
a       b       c
 
115
1       1       1
 
116
4       1       1
 
117
2       1       1
 
118
5       1       1
 
119
3       1       1
 
120
update t1 set c=3 where b=1;
 
121
select * from t1;
 
122
a       b       c
 
123
1       1       3
 
124
4       1       3
 
125
2       1       3
 
126
5       1       3
 
127
3       1       3
 
128
select b from t1 where a=3;
 
129
b
 
130
1
 
131
select b,c from t1 where a=1 AND b=1;
 
132
b       c
 
133
1       3
 
134
delete from t1 where a=1;
 
135
delete from t1 where c=3;
 
136
select * from t1;
 
137
a       b       c
 
138
ALTER TABLE t1
 
139
partition by hash (a + 3)
 
140
partitions 3
 
141
(partition x1 tablespace ts1,
 
142
partition x2 tablespace ts2,
 
143
partition x3 tablespace ts3);
 
144
select * from t1;
 
145
a       b       c
 
146
drop table t1;
 
147
CREATE TABLE t1 (
 
148
a int not null,
 
149
b int not null,
 
150
c int not null,
 
151
primary key(a,b))
 
152
partition by hash (a)
 
153
(partition x1);
 
154
drop table t1;
 
155
CREATE TABLE t1 (
 
156
a int not null,
 
157
b int not null,
 
158
c int not null,
 
159
primary key(a,b))
 
160
partition by key (a)
 
161
(partition x1);
 
162
drop table t1;
 
163
CREATE TABLE t1 (f1 INTEGER, f2 char(20)) ENGINE = 'MYISAM' PARTITION BY HASH(f1) PARTITIONS 2;
 
164
INSERT INTO t1 SET f1 = 0 - 1, f2 = '#######';
 
165
select * from t1;
 
166
f1      f2
 
167
-1      #######
 
168
drop table t1;
 
169
CREATE TABLE t1 (s1 int) ENGINE=BLACKHOLE PARTITION BY HASH (s1);
 
170
INSERT INTO t1 VALUES (0);
 
171
DROP TABLE t1;
 
172
create table t1 (c1 int DEFAULT NULL,
 
173
c2 varchar (30) DEFAULT NULL,
 
174
c3 date DEFAULT NULL)
 
175
engine = myisam
 
176
partition by hash (to_days(c3))
 
177
partitions 12;
 
178
insert into t1 values
 
179
(136,'abc','2002-01-05'),(142,'abc','2002-02-14'),(162,'abc','2002-06-28'),
 
180
(182,'abc','2002-11-09'),(158,'abc','2002-06-01'),(184,'abc','2002-11-22');
 
181
select * from t1;
 
182
c1      c2      c3
 
183
136     abc     2002-01-05
 
184
158     abc     2002-06-01
 
185
142     abc     2002-02-14
 
186
162     abc     2002-06-28
 
187
182     abc     2002-11-09
 
188
184     abc     2002-11-22
 
189
select * from t1 where c3 between '2002-01-01' and '2002-12-31';
 
190
c1      c2      c3
 
191
136     abc     2002-01-05
 
192
158     abc     2002-06-01
 
193
142     abc     2002-02-14
 
194
162     abc     2002-06-28
 
195
182     abc     2002-11-09
 
196
184     abc     2002-11-22
 
197
drop table t1;
 
198
CREATE TABLE t1 (c1 INT) ENGINE=MyISAM PARTITION BY HASH(c1) PARTITIONS 1;
 
199
INSERT DELAYED INTO t1 VALUES (1);
 
200
DROP TABLE t1;