| 1 |
--source include/have_ndb.inc |
| 2 |
# |
| 3 |
# Simple test for the partition storage engine |
| 4 |
# Focuses on range partitioning tests |
| 5 |
# |
| 6 |
#-- source include/have_partition.inc |
| 7 |
|
| 8 |
--disable_query_log |
| 9 |
set new=on; |
| 10 |
--enable_query_log |
| 11 |
|
| 12 |
--disable_warnings |
| 13 |
drop table if exists t1; |
| 14 |
--enable_warnings |
| 15 |
|
| 16 |
# |
| 17 |
# Partition by hash, basic |
| 18 |
# |
| 19 |
|
| 20 |
|
| 21 |
# |
| 22 |
# BUG37934: |
| 23 |
# Partition pruning is broken for DBT2 table |
| 24 |
# Testcase from Mikael Ronstrom. |
| 25 |
# Note that the testcase did not fail previously, but accessed |
| 26 |
# partitions unnecessarily |
| 27 |
# Testcase now checks that all scan accesses are pruned at |
| 28 |
# NDBAPI level |
| 29 |
# |
| 30 |
CREATE TABLE t1 ( |
| 31 |
ol_o_id int NOT NULL, |
| 32 |
ol_d_id int NOT NULL, |
| 33 |
ol_w_id int NOT NULL, |
| 34 |
ol_number int NOT NULL, |
| 35 |
ol_tmp int, |
| 36 |
PRIMARY KEY (ol_w_id, ol_d_id, ol_o_id, ol_number) |
| 37 |
) ENGINE=NDB |
| 38 |
PARTITION BY HASH (ol_w_id); |
| 39 |
|
| 40 |
insert into t1 values (1,0,0,0,0),(1,0,0,1,0),(1,0,0,2,0),(1,1,0,0,0),(1,1,0,1,0); |
| 41 |
insert into t1 values (2,0,0,0,0),(4,0,0,0,0),(4,0,0,1,0); |
| 42 |
insert into t1 values (0,1,1,4,0),(0,1,1,5,0); # Only rows affected. |
| 43 |
|
| 44 |
--source suite/ndb/include/ndb_init_scan_counts.inc |
| 45 |
UPDATE t1 force index (primary) SET ol_tmp = 1 |
| 46 |
WHERE ol_o_id = 0 AND ol_d_id = 1 AND ol_w_id = 1; |
| 47 |
--source suite/ndb/include/ndb_scan_counts.inc |
| 48 |
|
| 49 |
--source suite/ndb/include/ndb_init_scan_counts.inc |
| 50 |
SELECT * FROM t1 WHERE ol_w_id = 1 AND ol_d_id = 1 AND ol_o_id = 0; |
| 51 |
--source suite/ndb/include/ndb_scan_counts.inc |
| 52 |
|
| 53 |
--source suite/ndb/include/ndb_init_scan_counts.inc |
| 54 |
SELECT SUM(ol_number) FROM t1 WHERE ol_o_id = 0 AND ol_w_id = 1 AND ol_d_id = 1; |
| 55 |
--source suite/ndb/include/ndb_scan_counts.inc |
| 56 |
|
| 57 |
drop table t1; |
| 58 |
|