1
DROP TABLE IF EXISTS t1;
2
CREATE TABLE t1 (a int, b int, c int, d int, PRIMARY KEY(a,b,c))
4
PARTITION BY KEY (a,b);
5
insert into t1 values (1,1,1,1);
9
update t1 set d = 2 where a = 1 and b = 1 and c = 1;
17
CREATE TABLE t1 (a int, b int, c int, d int, PRIMARY KEY(a,b))
20
ERROR HY000: A PRIMARY KEY must include all columns in the table's partitioning function
21
CREATE TABLE t1 (a int, b int, c int, PRIMARY KEY(a,b))
25
(1,1,3),(1,2,3),(1,3,3),(1,4,3),(1,5,3),(1,6,3),
26
(1,7,3),(1,8,3),(1,9,3),(1,10,3),(1,11,3),(1,12,3);
27
select * from t1 order by b;
42
CREATE TABLE t1 (a INT, b CHAR(10) COLLATE latin1_bin, c INT, d INT,
43
PRIMARY KEY (a,b,c) USING HASH)
45
DEFAULT CHARSET=latin1
47
insert into t1 values (1,"a",1,1),(2,"a",1,1),(3,"a",1,1);
55
Number of attributes: 4
56
Number of primary keys: 3
62
TableStatus: Retrieved
64
a Int PRIMARY KEY AT=FIXED ST=MEMORY
65
b Char(10;latin1_bin) PRIMARY KEY DISTRIBUTION KEY AT=FIXED ST=MEMORY
66
c Int PRIMARY KEY AT=FIXED ST=MEMORY
67
d Int NULL AT=FIXED ST=MEMORY
70
PRIMARY KEY(a, b, c) - UniqueHashIndex
73
NDBT_ProgramExit: 0 - OK
77
t1 CREATE TABLE `t1` (
78
`a` int(11) NOT NULL DEFAULT '0',
79
`b` char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '',
80
`c` int(11) NOT NULL DEFAULT '0',
81
`d` int(11) DEFAULT NULL,
82
PRIMARY KEY (`a`,`b`,`c`) USING HASH
83
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (b) */
85
CREATE TABLE t1 (a int not null primary key)
87
(PARTITION p0 ENGINE = NDB, PARTITION p1 ENGINE = NDB);
89
CREATE TABLE t1 (a int not null primary key);
93
(PARTITION p0 ENGINE = NDB, PARTITION p1 ENGINE = NDB);
95
CREATE TABLE t1 (a int not null primary key) ENGINE = NDB;
98
(PARTITION p0 ENGINE = NDB, PARTITION p1 ENGINE = NDB);
100
create table t1 (a int)
103
(partition p0, partition p1);
104
show create table t1;
106
t1 CREATE TABLE `t1` (
107
`a` int(11) DEFAULT NULL
108
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION p0 ENGINE = ndbcluster, PARTITION p1 ENGINE = ndbcluster) */
109
alter table t1 engine=heap;
110
show create table t1;
112
t1 CREATE TABLE `t1` (
113
`a` int(11) DEFAULT NULL
114
) ENGINE=MEMORY DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION p0 ENGINE = MEMORY, PARTITION p1 ENGINE = MEMORY) */
115
alter table t1 engine=ndb;
116
show create table t1;
118
t1 CREATE TABLE `t1` (
119
`a` int(11) DEFAULT NULL
120
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION p0 ENGINE = ndbcluster, PARTITION p1 ENGINE = ndbcluster) */
121
alter table t1 engine=heap remove partitioning;
122
show create table t1;
124
t1 CREATE TABLE `t1` (
125
`a` int(11) DEFAULT NULL
126
) ENGINE=MEMORY DEFAULT CHARSET=latin1
127
alter table t1 engine=ndb
129
(partition p0, partition p1 engine = ndb);
130
show create table t1;
132
t1 CREATE TABLE `t1` (
133
`a` int(11) DEFAULT NULL
134
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION p0 ENGINE = ndbcluster, PARTITION p1 ENGINE = ndbcluster) */
137
(partition p0 engine=ndb, partition p1 engine=ndb);
138
show create table t1;
140
t1 CREATE TABLE `t1` (
141
`a` int(11) DEFAULT NULL
142
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION p0 ENGINE = ndbcluster, PARTITION p1 ENGINE = ndbcluster) */
143
alter table t1 remove partitioning;
144
show create table t1;
146
t1 CREATE TABLE `t1` (
147
`a` int(11) DEFAULT NULL
148
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
151
(partition p0 engine=ndb, partition p1);
155
(partition p0 engine=ndb, partition p1 engine = ndb);
156
show create table t1;
158
t1 CREATE TABLE `t1` (
159
`a` int(11) DEFAULT NULL
160
) ENGINE=ndbcluster DEFAULT CHARSET=latin1 /*!50100 PARTITION BY KEY (a) (PARTITION p0 ENGINE = ndbcluster, PARTITION p1 ENGINE = ndbcluster) */
163
c1 MEDIUMINT NOT NULL AUTO_INCREMENT,
172
PARTITION BY KEY(c3) PARTITIONS 5;
173
ALTER TABLE t1 COALESCE PARTITION 4;
175
CREATE TABLE t1 (a int primary key)
178
ALTER TABLE t1 OPTIMIZE PARTITION p0;
179
ERROR HY000: Table storage engine for 't1' doesn't have this option
180
ALTER TABLE t1 CHECK PARTITION p0;
181
ERROR HY000: Table storage engine for 't1' doesn't have this option
182
ALTER TABLE t1 REPAIR PARTITION p0;
183
ERROR HY000: Table storage engine for 't1' doesn't have this option
184
ALTER TABLE t1 ANALYZE PARTITION p0;
185
ERROR HY000: Table storage engine for 't1' doesn't have this option
186
ALTER TABLE t1 REBUILD PARTITION p0;
187
ERROR HY000: Table storage engine for 't1' doesn't have this option
190
c1 MEDIUMINT NOT NULL AUTO_INCREMENT,
195
PARTITION BY KEY(c3) PARTITIONS 5;
196
ALTER TABLE t1 ADD COLUMN c4 INT AFTER c1;
199
c1 MEDIUMINT NOT NULL AUTO_INCREMENT,
204
PARTITION BY KEY(c3);
205
ALTER TABLE t1 ADD COLUMN c4 INT AFTER c1;