summaryrefslogtreecommitdiff
path: root/mysql-test/r/partition_hash.result
blob: 2165630e4fb5f51809567c58a85ea10f3074c224 (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
drop table if exists t1;
CREATE TABLE t1 (
a int not null,
b int not null,
c int not null,
primary key(a,b))
partition by hash (a + 2)
partitions 3
(partition x1 tablespace ts1,
partition x2 tablespace ts2,
partition x3 tablespace ts3);
insert into t1 values (1,1,1);
insert into t1 values (2,1,1);
insert into t1 values (3,1,1);
insert into t1 values (4,1,1);
insert into t1 values (5,1,1);
select * from t1;
a	b	c
1	1	1
4	1	1
2	1	1
5	1	1
3	1	1
update t1 set c=3 where b=1;
select * from t1;
a	b	c
1	1	3
4	1	3
2	1	3
5	1	3
3	1	3
select b from t1 where a=3;
b
1
select b,c from t1 where a=1 AND b=1;
b	c
1	3
delete from t1 where a=1;
delete from t1 where c=3;
select * from t1;
a	b	c
ALTER TABLE t1
partition by hash (a + 3)
partitions 3
(partition x1 tablespace ts1,
partition x2 tablespace ts2,
partition x3 tablespace ts3);
select * from t1;
a	b	c
drop table t1;
CREATE TABLE t1 (
a int not null,
b int not null,
c int not null,
primary key(a,b))
partition by hash (a)
(partition x1);
drop table t1;
CREATE TABLE t1 (
a int not null,
b int not null,
c int not null,
primary key(a,b))
partition by key (a)
(partition x1);
drop table t1;