| 1 |
Warnings: |
| 2 |
Warning 1287 '@@new' is deprecated and will be removed in a future release. |
| 3 |
drop table if exists t1; |
| 4 |
CREATE TABLE t1 ( f_int1 INTEGER NOT NULL, f_int2 INTEGER NOT NULL, |
| 5 |
f_char1 CHAR(10), |
| 6 |
f_char2 CHAR(10), f_charbig VARCHAR(1000), |
| 7 |
PRIMARY KEY (f_int1,f_int2)) |
| 8 |
ENGINE = NDB |
| 9 |
PARTITION BY LIST(MOD(f_int1 + f_int2,4)) |
| 10 |
(PARTITION part_3 VALUES IN (-3), |
| 11 |
PARTITION part_2 VALUES IN (-2), |
| 12 |
PARTITION part_1 VALUES IN (-1), |
| 13 |
PARTITION part0 VALUES IN (0), |
| 14 |
PARTITION part1 VALUES IN (1), |
| 15 |
PARTITION part2 VALUES IN (2), |
| 16 |
PARTITION part3 VALUES IN (3,4,5)); |
| 17 |
INSERT INTO t1 SET f_int1 = -2, f_int2 = 20, f_char1 = '20', f_char2 = '20', f_charbig = '===20==='; |
| 18 |
INSERT INTO t1 SET f_int1 = 1, f_int2 = 1, f_char1 = '1', f_char2 = '1', f_charbig = '===1==='; |
| 19 |
INSERT INTO t1 SET f_int1 = 2, f_int2 = 1, f_char1 = '1', f_char2 = '1', f_charbig = '===1==='; |
| 20 |
INSERT INTO t1 SET f_int1 = 3, f_int2 = 1, f_char1 = '1', f_char2 = '1', f_charbig = '===1==='; |
| 21 |
INSERT INTO t1 SET f_int1 = 4, f_int2 = 1, f_char1 = '1', f_char2 = '1', f_charbig = '===1==='; |
| 22 |
INSERT INTO t1 SET f_int1 = 5, f_int2 = 1, f_char1 = '1', f_char2 = '1', f_charbig = '===1==='; |
| 23 |
INSERT INTO t1 SET f_int1 = 20, f_int2 = 1, f_char1 = '1', f_char2 = '1', f_charbig = '===1==='; |
| 24 |
SELECT * FROM t1 ORDER BY f_int1; |
| 25 |
f_int1 f_int2 f_char1 f_char2 f_charbig |
| 26 |
-2 20 20 20 ===20=== |
| 27 |
1 1 1 1 ===1=== |
| 28 |
2 1 1 1 ===1=== |
| 29 |
3 1 1 1 ===1=== |
| 30 |
4 1 1 1 ===1=== |
| 31 |
5 1 1 1 ===1=== |
| 32 |
20 1 1 1 ===1=== |
| 33 |
DROP TABLE t1; |
| 34 |
create table t1 ( a int, b int, c int, primary key (a,b)) engine=ndb |
| 35 |
partition by list (a) |
| 36 |
(partition part0 values in (0,1,2), |
| 37 |
partition part1 values in (3,4,5)); |
| 38 |
insert into t1 values (0, 0, 0); |
| 39 |
insert into t1 values (0, 1, 1); |
| 40 |
insert into t1 values (0, 2, 2); |
| 41 |
insert into t1 values (1, 0, 3); |
| 42 |
insert into t1 values (1, 1, 4); |
| 43 |
insert into t1 values (1, 2, 5); |
| 44 |
insert into t1 values (4, 0, 6); |
| 45 |
insert into t1 values (4, 1, 7); |
| 46 |
insert into t1 values (4, 2, 8); |
| 47 |
All partitions scan |
| 48 |
select * from t1 order by c; |
| 49 |
a b c |
| 50 |
0 0 0 |
| 51 |
0 1 1 |
| 52 |
0 2 2 |
| 53 |
1 0 3 |
| 54 |
1 1 4 |
| 55 |
1 2 5 |
| 56 |
4 0 6 |
| 57 |
4 1 7 |
| 58 |
4 2 8 |
| 59 |
ndb_scan_count |
| 60 |
1 |
| 61 |
ndb_pruned_scan_count |
| 62 |
0 |
| 63 |
Single partition scan |
| 64 |
select * from t1 where a=0 order by c; |
| 65 |
a b c |
| 66 |
0 0 0 |
| 67 |
0 1 1 |
| 68 |
0 2 2 |
| 69 |
ndb_scan_count |
| 70 |
1 |
| 71 |
ndb_pruned_scan_count |
| 72 |
1 |
| 73 |
Single partition scan |
| 74 |
select * from t1 where a=4 order by c; |
| 75 |
a b c |
| 76 |
4 0 6 |
| 77 |
4 1 7 |
| 78 |
4 2 8 |
| 79 |
ndb_scan_count |
| 80 |
1 |
| 81 |
ndb_pruned_scan_count |
| 82 |
1 |
| 83 |
MRR single partition scan |
| 84 |
select * from t1 where a in (0, 2) order by c; |
| 85 |
a b c |
| 86 |
0 0 0 |
| 87 |
0 1 1 |
| 88 |
0 2 2 |
| 89 |
ndb_scan_count |
| 90 |
1 |
| 91 |
ndb_pruned_scan_count |
| 92 |
1 |
| 93 |
drop table t1; |