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

« back to all changes in this revision

Viewing changes to mysql-test/suite/ndb/r/ndb_partition_key.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 (a int, b int, c int, d int, PRIMARY KEY(a,b,c))
 
3
ENGINE = NDB
 
4
PARTITION BY KEY (a,b);
 
5
insert into t1 values (1,1,1,1);
 
6
select * from t1;
 
7
a       b       c       d
 
8
1       1       1       1
 
9
update t1 set d = 2 where a = 1 and b = 1 and c = 1;
 
10
select * from t1;
 
11
a       b       c       d
 
12
1       1       1       2
 
13
delete from t1;
 
14
select * from t1;
 
15
a       b       c       d
 
16
drop table t1;
 
17
CREATE TABLE t1 (a int, b int, c int, d int, PRIMARY KEY(a,b))
 
18
ENGINE = NDB
 
19
PARTITION BY KEY (c);
 
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))
 
22
ENGINE = NDB
 
23
PARTITION BY KEY (a);
 
24
insert into t1 values 
 
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;
 
28
a       b       c
 
29
1       1       3
 
30
1       2       3
 
31
1       3       3
 
32
1       4       3
 
33
1       5       3
 
34
1       6       3
 
35
1       7       3
 
36
1       8       3
 
37
1       9       3
 
38
1       10      3
 
39
1       11      3
 
40
1       12      3
 
41
select max(b) from t1 where a = 1;
 
42
max(b)
 
43
12
 
44
select b from t1 where a = 1 order by b desc;
 
45
b
 
46
12
 
47
11
 
48
10
 
49
9
 
50
8
 
51
7
 
52
6
 
53
5
 
54
4
 
55
3
 
56
2
 
57
1
 
58
DROP TABLE t1;
 
59
CREATE TABLE t1 (a INT, b CHAR(10) COLLATE latin1_bin, c INT, d INT,
 
60
PRIMARY KEY (a,b,c) USING HASH)
 
61
ENGINE=NDB
 
62
DEFAULT CHARSET=latin1
 
63
PARTITION BY KEY (b);
 
64
insert into t1 values (1,"a",1,1),(2,"a",1,1),(3,"a",1,1);
 
65
-- t1 --
 
66
 
 
67
Fragment type: 5
 
68
K Value: 6
 
69
Min load factor: 78
 
70
Max load factor: 80
 
71
Temporary table: no
 
72
Number of attributes: 4
 
73
Number of primary keys: 3
 
74
Length of frm data: #
 
75
Row Checksum: 1
 
76
Row GCI: 1
 
77
SingleUserMode: 0
 
78
ForceVarPart: 1
 
79
TableStatus: Retrieved
 
80
-- Attributes -- 
 
81
a Int PRIMARY KEY AT=FIXED ST=MEMORY
 
82
b Char(10;latin1_bin) PRIMARY KEY DISTRIBUTION KEY AT=FIXED ST=MEMORY
 
83
c Int PRIMARY KEY AT=FIXED ST=MEMORY
 
84
d Int NULL AT=FIXED ST=MEMORY
 
85
 
 
86
-- Indexes -- 
 
87
PRIMARY KEY(a, b, c) - UniqueHashIndex
 
88
 
 
89
 
 
90
NDBT_ProgramExit: 0 - OK
 
91
 
 
92
show create table t1;
 
93
Table   Create Table
 
94
t1      CREATE TABLE `t1` (
 
95
  `a` int(11) NOT NULL DEFAULT '0',
 
96
  `b` char(10) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '',
 
97
  `c` int(11) NOT NULL DEFAULT '0',
 
98
  `d` int(11) DEFAULT NULL,
 
99
  PRIMARY KEY (`a`,`b`,`c`) USING HASH
 
100
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
 
101
/*!50100 PARTITION BY KEY (b) */
 
102
DROP TABLE t1;
 
103
CREATE TABLE t1 (a int not null primary key)
 
104
PARTITION BY KEY(a)
 
105
(PARTITION p0 ENGINE = NDB, PARTITION p1 ENGINE = NDB);
 
106
drop table t1;
 
107
CREATE TABLE t1 (a int not null primary key);
 
108
ALTER TABLE t1
 
109
ENGINE = NDB
 
110
PARTITION BY KEY(a)
 
111
(PARTITION p0 ENGINE = NDB, PARTITION p1 ENGINE = NDB);
 
112
drop table t1;
 
113
CREATE TABLE t1 (a int not null primary key) ENGINE = NDB;
 
114
ALTER TABLE t1
 
115
PARTITION BY KEY(a)
 
116
(PARTITION p0 ENGINE = NDB, PARTITION p1 ENGINE = NDB);
 
117
drop table t1;
 
118
create table t1 (a int)
 
119
engine=ndb
 
120
partition by key(a)
 
121
(partition p0, partition p1);
 
122
show create table t1;
 
123
Table   Create Table
 
124
t1      CREATE TABLE `t1` (
 
125
  `a` int(11) DEFAULT NULL
 
126
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
 
127
/*!50100 PARTITION BY KEY (a)
 
128
(PARTITION p0 ENGINE = ndbcluster,
 
129
 PARTITION p1 ENGINE = ndbcluster) */
 
130
alter table t1 engine=heap;
 
131
show create table t1;
 
132
Table   Create Table
 
133
t1      CREATE TABLE `t1` (
 
134
  `a` int(11) DEFAULT NULL
 
135
) ENGINE=MEMORY DEFAULT CHARSET=latin1
 
136
/*!50100 PARTITION BY KEY (a)
 
137
(PARTITION p0 ENGINE = MEMORY,
 
138
 PARTITION p1 ENGINE = MEMORY) */
 
139
alter table t1 engine=ndb;
 
140
show create table t1;
 
141
Table   Create Table
 
142
t1      CREATE TABLE `t1` (
 
143
  `a` int(11) DEFAULT NULL
 
144
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
 
145
/*!50100 PARTITION BY KEY (a)
 
146
(PARTITION p0 ENGINE = ndbcluster,
 
147
 PARTITION p1 ENGINE = ndbcluster) */
 
148
alter table t1 engine=heap remove partitioning;
 
149
show create table t1;
 
150
Table   Create Table
 
151
t1      CREATE TABLE `t1` (
 
152
  `a` int(11) DEFAULT NULL
 
153
) ENGINE=MEMORY DEFAULT CHARSET=latin1
 
154
alter table t1 engine=ndb
 
155
partition by key(a)
 
156
(partition p0, partition p1 engine = ndb);
 
157
show create table t1;
 
158
Table   Create Table
 
159
t1      CREATE TABLE `t1` (
 
160
  `a` int(11) DEFAULT NULL
 
161
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
 
162
/*!50100 PARTITION BY KEY (a)
 
163
(PARTITION p0 ENGINE = ndbcluster,
 
164
 PARTITION p1 ENGINE = ndbcluster) */
 
165
alter table t1
 
166
partition by key (a)
 
167
(partition p0 engine=ndb, partition p1 engine=ndb);
 
168
show create table t1;
 
169
Table   Create Table
 
170
t1      CREATE TABLE `t1` (
 
171
  `a` int(11) DEFAULT NULL
 
172
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
 
173
/*!50100 PARTITION BY KEY (a)
 
174
(PARTITION p0 ENGINE = ndbcluster,
 
175
 PARTITION p1 ENGINE = ndbcluster) */
 
176
alter table t1 remove partitioning;
 
177
show create table t1;
 
178
Table   Create Table
 
179
t1      CREATE TABLE `t1` (
 
180
  `a` int(11) DEFAULT NULL
 
181
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
 
182
alter table t1
 
183
partition by key(a)
 
184
(partition p0 engine=ndb, partition p1);
 
185
alter table t1
 
186
engine=ndb
 
187
partition by key(a)
 
188
(partition p0 engine=ndb, partition p1 engine = ndb);
 
189
show create table t1;
 
190
Table   Create Table
 
191
t1      CREATE TABLE `t1` (
 
192
  `a` int(11) DEFAULT NULL
 
193
) ENGINE=ndbcluster DEFAULT CHARSET=latin1
 
194
/*!50100 PARTITION BY KEY (a)
 
195
(PARTITION p0 ENGINE = ndbcluster,
 
196
 PARTITION p1 ENGINE = ndbcluster) */
 
197
drop table t1;
 
198
CREATE TABLE t1 (
 
199
c1 MEDIUMINT NOT NULL AUTO_INCREMENT,
 
200
c2 TEXT NOT NULL,
 
201
c3 INT NOT NULL,
 
202
c4 BIT NOT NULL,
 
203
c5 FLOAT,
 
204
c6 VARCHAR(255),
 
205
c7 TIMESTAMP,
 
206
PRIMARY KEY(c1,c3))
 
207
ENGINE=NDB
 
208
PARTITION BY KEY(c3) PARTITIONS 5;
 
209
ALTER TABLE t1 COALESCE PARTITION 4;
 
210
DROP TABLE t1;
 
211
CREATE TABLE t1 (a int primary key)
 
212
ENGINE=NDB
 
213
PARTITION BY KEY(a);
 
214
ANALYZE TABLE t1;
 
215
Table   Op      Msg_type        Msg_text
 
216
test.t1 analyze note    The storage engine for the table doesn't support analyze
 
217
CHECK TABLE t1;
 
218
Table   Op      Msg_type        Msg_text
 
219
test.t1 check   note    The storage engine for the table doesn't support check
 
220
OPTIMIZE TABLE t1;
 
221
Table   Op      Msg_type        Msg_text
 
222
test.t1 optimize        note    The storage engine for the table doesn't support optimize
 
223
REPAIR TABLE t1;
 
224
Table   Op      Msg_type        Msg_text
 
225
test.t1 repair  note    The storage engine for the table doesn't support repair
 
226
ALTER TABLE t1 OPTIMIZE PARTITION p0;
 
227
Table   Op      Msg_type        Msg_text
 
228
test.t1 optimize        note    The storage engine for the table doesn't support optimize
 
229
ALTER TABLE t1 CHECK PARTITION p0;
 
230
Table   Op      Msg_type        Msg_text
 
231
test.t1 check   note    The storage engine for the table doesn't support check
 
232
ALTER TABLE t1 REPAIR PARTITION p0;
 
233
Table   Op      Msg_type        Msg_text
 
234
test.t1 repair  note    The storage engine for the table doesn't support repair
 
235
ALTER TABLE t1 ANALYZE PARTITION p0;
 
236
Table   Op      Msg_type        Msg_text
 
237
test.t1 analyze note    The storage engine for the table doesn't support analyze
 
238
ALTER TABLE t1 REBUILD PARTITION p0;
 
239
ERROR HY000: Table storage engine for 't1' doesn't have this option
 
240
DROP TABLE t1;
 
241
CREATE TABLE t1 (
 
242
c1 MEDIUMINT NOT NULL AUTO_INCREMENT,
 
243
c2 TEXT NOT NULL,
 
244
c3 INT NOT NULL,
 
245
PRIMARY KEY(c1,c3))
 
246
ENGINE=NDB
 
247
PARTITION BY KEY(c3) PARTITIONS 5;
 
248
ALTER TABLE t1 ADD COLUMN c4 INT AFTER c1;
 
249
DROP TABLE t1;
 
250
CREATE TABLE t1 (
 
251
c1 MEDIUMINT NOT NULL AUTO_INCREMENT,
 
252
c2 TEXT NOT NULL,
 
253
c3 INT NOT NULL,
 
254
PRIMARY KEY(c1,c3))
 
255
ENGINE=NDB
 
256
PARTITION BY KEY(c3)
 
257
(PARTITION p0 NODEGROUP 0, PARTITION p1 NODEGROUP 0);
 
258
ALTER TABLE t1 ADD COLUMN c4 INT AFTER c1;
 
259
SELECT NODEGROUP,PARTITION_NAME FROM information_schema.partitions WHERE
 
260
table_name = "t1";
 
261
NODEGROUP       PARTITION_NAME
 
262
0       p0
 
263
0       p1
 
264
DROP TABLE t1;
 
265
CREATE TABLE t1 (
 
266
a tinyint unsigned NOT NULL,
 
267
b bigint(20) unsigned NOT NULL,
 
268
c char(12),
 
269
PRIMARY KEY (a,b)
 
270
) ENGINE ndb DEFAULT CHARSET=latin1 PARTITION BY KEY (a);
 
271
insert into t1 values(1,1,'1'), (2,2,'2'), (3,3,'3'), (4,4,'4'), (5,5,'5');
 
272
select * from t1 where a = 1;
 
273
a       b       c
 
274
1       1       1
 
275
select * from t1 where a = 2;
 
276
a       b       c
 
277
2       2       2
 
278
select * from t1 where a = 3;
 
279
a       b       c
 
280
3       3       3
 
281
select * from t1 where a = 4;
 
282
a       b       c
 
283
4       4       4
 
284
select * from t1 where a = 5;
 
285
a       b       c
 
286
5       5       5
 
287
delete from t1 where a = 1;
 
288
select * from t1 order by 1;
 
289
a       b       c
 
290
2       2       2
 
291
3       3       3
 
292
4       4       4
 
293
5       5       5
 
294
delete from t1 where a = 2;
 
295
select * from t1 order by 1;
 
296
a       b       c
 
297
3       3       3
 
298
4       4       4
 
299
5       5       5
 
300
delete from t1 where a = 3;
 
301
select * from t1 order by 1;
 
302
a       b       c
 
303
4       4       4
 
304
5       5       5
 
305
delete from t1 where a = 4;
 
306
select * from t1 order by 1;
 
307
a       b       c
 
308
5       5       5
 
309
delete from t1 where a = 5;
 
310
select * from t1 order by 1;
 
311
a       b       c
 
312
drop table t1;