File: ndb_partition_list.test

package info (click to toggle)
percona-xtrabackup 2.2.3-2.1
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 293,260 kB
  • ctags: 146,881
  • sloc: cpp: 1,051,960; ansic: 570,217; java: 54,595; perl: 53,495; pascal: 44,194; sh: 27,826; yacc: 15,314; python: 12,142; xml: 7,848; sql: 4,125; makefile: 1,459; awk: 785; lex: 758
file content (83 lines) | stat: -rw-r--r-- 2,738 bytes parent folder | download | duplicates (2)
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
--source include/have_ndb.inc
#
# Simple test for the partition storage engine
# Focuses on range partitioning tests
# 
#-- source include/have_partition.inc

--disable_query_log
set new=on;
--enable_query_log

--disable_warnings
drop table if exists t1;
--enable_warnings

#
# Partition by list, basic
#

CREATE TABLE t1 ( f_int1 INTEGER NOT NULL, f_int2 INTEGER NOT NULL, 
	          f_char1 CHAR(10),
                  f_char2 CHAR(10), f_charbig VARCHAR(1000),
PRIMARY KEY (f_int1,f_int2))
ENGINE = NDB
PARTITION BY LIST(MOD(f_int1 + f_int2,4)) 
(PARTITION part_3 VALUES IN (-3),
 PARTITION part_2 VALUES IN (-2),
 PARTITION part_1 VALUES IN (-1),
 PARTITION part0 VALUES IN (0),
 PARTITION part1 VALUES IN (1),
 PARTITION part2 VALUES IN (2),
 PARTITION part3 VALUES IN (3,4,5));

INSERT INTO t1 SET f_int1 = -2, f_int2 = 20, f_char1 = '20', f_char2 = '20', f_charbig = '===20===';
INSERT INTO t1 SET f_int1 = 1, f_int2 = 1, f_char1 = '1', f_char2 = '1', f_charbig = '===1===';
INSERT INTO t1 SET f_int1 = 2, f_int2 = 1, f_char1 = '1', f_char2 = '1', f_charbig = '===1===';
INSERT INTO t1 SET f_int1 = 3, f_int2 = 1, f_char1 = '1', f_char2 = '1', f_charbig = '===1===';
INSERT INTO t1 SET f_int1 = 4, f_int2 = 1, f_char1 = '1', f_char2 = '1', f_charbig = '===1===';
INSERT INTO t1 SET f_int1 = 5, f_int2 = 1, f_char1 = '1', f_char2 = '1', f_charbig = '===1===';
INSERT INTO t1 SET f_int1 = 20, f_int2 = 1, f_char1 = '1', f_char2 = '1', f_charbig = '===1===';

SELECT * FROM t1 ORDER BY f_int1;

DROP TABLE t1;

# Check partition pruning at NdbApi level for list partitioned table
#
create table t1 ( a int, b int, c int, primary key (a,b)) engine=ndb 
partition by list (a)
(partition part0 values in (0,1,2),
 partition part1 values in (3,4,5));

insert into t1 values (0, 0, 0);
insert into t1 values (0, 1, 1);
insert into t1 values (0, 2, 2);
insert into t1 values (1, 0, 3);
insert into t1 values (1, 1, 4);
insert into t1 values (1, 2, 5);
insert into t1 values (4, 0, 6);
insert into t1 values (4, 1, 7);
insert into t1 values (4, 2, 8);

--echo All partitions scan
--source suite/ndb/include/ndb_init_scan_counts.inc
select * from t1 order by c;
--source suite/ndb/include/ndb_scan_counts.inc

--echo Single partition scan
--source suite/ndb/include/ndb_init_scan_counts.inc
select * from t1 where a=0 order by c;
--source suite/ndb/include/ndb_scan_counts.inc

--echo Single partition scan
--source suite/ndb/include/ndb_init_scan_counts.inc
select * from t1 where a=4 order by c;
--source suite/ndb/include/ndb_scan_counts.inc

--echo MRR single partition scan
--source suite/ndb/include/ndb_init_scan_counts.inc
select * from t1 where a in (0, 2) order by c;
--source suite/ndb/include/ndb_scan_counts.inc

drop table t1;