summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRich Prohaska <prohaska@tokutek.com>2014-09-13 16:06:55 -0400
committerRich Prohaska <prohaska@tokutek.com>2014-09-13 16:06:55 -0400
commitd85b993ca813e4a793b20bb7694a28ef404740c8 (patch)
treebebf575fdcc677a6dc5bce4476f7ea64701aa0db
parentb73bef237aa6456ba0ffe08e6eba1102d42d1864 (diff)
downloadmariadb-git-d85b993ca813e4a793b20bb7694a28ef404740c8.tar.gz
DB-504 redo bulk fetch select tests in partitioned tables
-rw-r--r--mysql-test/suite/tokudb.bugs/r/part_index_scan.result248
-rw-r--r--mysql-test/suite/tokudb.bugs/t/part_index_scan.test157
-rw-r--r--mysql-test/suite/tokudb/r/bf_create_select.result (renamed from mysql-test/suite/tokudb/r/bf_create_select_nonpart.result)0
-rw-r--r--mysql-test/suite/tokudb/r/bf_create_temp_select.result (renamed from mysql-test/suite/tokudb/r/bf_create_temp_select_nonpart.result)0
-rw-r--r--mysql-test/suite/tokudb/r/bf_delete.result (renamed from mysql-test/suite/tokudb/r/bf_delete_nonpart.result)0
-rw-r--r--mysql-test/suite/tokudb/r/bf_insert_select.result (renamed from mysql-test/suite/tokudb/r/bf_insert_select_nonpart.result)0
-rw-r--r--mysql-test/suite/tokudb/r/bf_insert_select_dup_key.result (renamed from mysql-test/suite/tokudb/r/bf_insert_select_dup_key_nonpart.result)0
-rw-r--r--mysql-test/suite/tokudb/r/bf_replace_select.result (renamed from mysql-test/suite/tokudb/r/bf_replace_select_nonpart.result)0
-rw-r--r--mysql-test/suite/tokudb/r/bf_select_hash_part.result278
-rw-r--r--mysql-test/suite/tokudb/r/bf_select_part.result543
-rw-r--r--mysql-test/suite/tokudb/r/bf_select_range_part.result286
-rw-r--r--mysql-test/suite/tokudb/t/bf_create_select.test (renamed from mysql-test/suite/tokudb/t/bf_create_select_nonpart.test)0
-rw-r--r--mysql-test/suite/tokudb/t/bf_create_temp_select.test (renamed from mysql-test/suite/tokudb/t/bf_create_temp_select_nonpart.test)0
-rw-r--r--mysql-test/suite/tokudb/t/bf_delete.test (renamed from mysql-test/suite/tokudb/t/bf_delete_nonpart.test)0
-rw-r--r--mysql-test/suite/tokudb/t/bf_insert_select.test (renamed from mysql-test/suite/tokudb/t/bf_insert_select_nonpart.test)0
-rw-r--r--mysql-test/suite/tokudb/t/bf_insert_select_dup_key.test (renamed from mysql-test/suite/tokudb/t/bf_insert_select_dup_key_nonpart.test)0
-rw-r--r--mysql-test/suite/tokudb/t/bf_replace_select.test (renamed from mysql-test/suite/tokudb/t/bf_replace_select_nonpart.test)0
-rw-r--r--mysql-test/suite/tokudb/t/bf_select_hash_part.test100
-rw-r--r--mysql-test/suite/tokudb/t/bf_select_part.test220
-rw-r--r--mysql-test/suite/tokudb/t/bf_select_range_part.test108
20 files changed, 772 insertions, 1168 deletions
diff --git a/mysql-test/suite/tokudb.bugs/r/part_index_scan.result b/mysql-test/suite/tokudb.bugs/r/part_index_scan.result
deleted file mode 100644
index 0d416c734b7..00000000000
--- a/mysql-test/suite/tokudb.bugs/r/part_index_scan.result
+++ /dev/null
@@ -1,248 +0,0 @@
-set default_storage_engine='tokudb';
-drop table if exists t,t1,t2,t3;
-CREATE TABLE `t` (
-`num` int(10) unsigned auto_increment NOT NULL,
-`val` varchar(32) DEFAULT NULL,
-PRIMARY KEY (`num`)
-);
-INSERT INTO t values (null,null);
-INSERT INTO t SELECT null,null FROM t;
-INSERT INTO t SELECT null,null FROM t;
-INSERT INTO t SELECT null,null FROM t;
-INSERT INTO t SELECT null,null FROM t;
-INSERT INTO t SELECT null,null FROM t;
-INSERT INTO t SELECT null,null FROM t;
-INSERT INTO t SELECT null,null FROM t;
-INSERT INTO t SELECT null,null FROM t;
-INSERT INTO t SELECT null,null FROM t;
-INSERT INTO t SELECT null,null FROM t;
-INSERT INTO t SELECT null,null FROM t;
-INSERT INTO t SELECT null,null FROM t;
-INSERT INTO t SELECT null,null FROM t;
-INSERT INTO t SELECT null,null FROM t;
-INSERT INTO t SELECT null,null FROM t;
-INSERT INTO t SELECT null,null FROM t;
-INSERT INTO t SELECT null,null FROM t;
-INSERT INTO t SELECT null,null FROM t;
-INSERT INTO t SELECT null,null FROM t;
-INSERT INTO t SELECT null,null FROM t;
-INSERT INTO t SELECT null,null FROM t;
-INSERT INTO t SELECT null,null FROM t;
-INSERT INTO t SELECT null,null FROM t;
-SELECT count(*) FROM t;
-count(*)
-8388608
-CREATE TABLE `t1` (
-`num` int(10) unsigned NOT NULL,
-`val` varchar(32) DEFAULT NULL,
-PRIMARY KEY (`num`)
-);
-CREATE TABLE `t2` (
-`num` int(10) unsigned NOT NULL,
-`val` varchar(32) DEFAULT NULL,
-PRIMARY KEY (`num`)
-)
-PARTITION BY HASH (num) PARTITIONS 10;
-CREATE TABLE `t3` (
-`num` int(10) unsigned NOT NULL,
-`val` varchar(32) DEFAULT NULL,
-PRIMARY KEY (`num`)
-)
-PARTITION BY RANGE (num)
-(PARTITION p0 VALUES LESS THAN (1000000),
-PARTITION p1 VALUES LESS THAN (2000000),
-PARTITION p2 VALUES LESS THAN (3000000),
-PARTITION p3 VALUES LESS THAN (4000000),
-PARTITION p4 VALUES LESS THAN (5000000),
-PARTITION p5 VALUES LESS THAN (6000000),
-PARTITION p6 VALUES LESS THAN (7000000),
-PARTITION p7 VALUES LESS THAN (8000000),
-PARTITION px VALUES LESS THAN MAXVALUE);
-insert into t1 select * from t;
-insert into t2 select * from t;
-insert into t3 select * from t;
-select count(*) from t1;
-count(*)
-8388608
-select count(*) from t1;
-count(*)
-8388608
-select count(*) from t1;
-count(*)
-8388608
-select count(*) from t1;
-count(*)
-8388608
-select count(*) from t1;
-count(*)
-8388608
-select count(*) from t1;
-count(*)
-8388608
-select count(*) from t1;
-count(*)
-8388608
-select count(*) from t1;
-count(*)
-8388608
-select count(*) from t1;
-count(*)
-8388608
-select count(*) from t1;
-count(*)
-8388608
-select count(*) from t2;
-count(*)
-8388608
-select count(*) from t2;
-count(*)
-8388608
-select count(*) from t2;
-count(*)
-8388608
-select count(*) from t2;
-count(*)
-8388608
-select count(*) from t2;
-count(*)
-8388608
-select count(*) from t2;
-count(*)
-8388608
-select count(*) from t2;
-count(*)
-8388608
-select count(*) from t2;
-count(*)
-8388608
-select count(*) from t2;
-count(*)
-8388608
-select count(*) from t2;
-count(*)
-8388608
-1
-select count(*) from t3;
-count(*)
-8388608
-select count(*) from t3;
-count(*)
-8388608
-select count(*) from t3;
-count(*)
-8388608
-select count(*) from t3;
-count(*)
-8388608
-select count(*) from t3;
-count(*)
-8388608
-select count(*) from t3;
-count(*)
-8388608
-select count(*) from t3;
-count(*)
-8388608
-select count(*) from t3;
-count(*)
-8388608
-select count(*) from t3;
-count(*)
-8388608
-select count(*) from t3;
-count(*)
-8388608
-1
-select count(*) from t1 where num>7000000;
-count(*)
-1847274
-select count(*) from t1 where num>7000000;
-count(*)
-1847274
-select count(*) from t1 where num>7000000;
-count(*)
-1847274
-select count(*) from t1 where num>7000000;
-count(*)
-1847274
-select count(*) from t1 where num>7000000;
-count(*)
-1847274
-select count(*) from t1 where num>7000000;
-count(*)
-1847274
-select count(*) from t1 where num>7000000;
-count(*)
-1847274
-select count(*) from t1 where num>7000000;
-count(*)
-1847274
-select count(*) from t1 where num>7000000;
-count(*)
-1847274
-select count(*) from t1 where num>7000000;
-count(*)
-1847274
-select count(*) from t2 where num>7000000;
-count(*)
-1847274
-select count(*) from t2 where num>7000000;
-count(*)
-1847274
-select count(*) from t2 where num>7000000;
-count(*)
-1847274
-select count(*) from t2 where num>7000000;
-count(*)
-1847274
-select count(*) from t2 where num>7000000;
-count(*)
-1847274
-select count(*) from t2 where num>7000000;
-count(*)
-1847274
-select count(*) from t2 where num>7000000;
-count(*)
-1847274
-select count(*) from t2 where num>7000000;
-count(*)
-1847274
-select count(*) from t2 where num>7000000;
-count(*)
-1847274
-select count(*) from t2 where num>7000000;
-count(*)
-1847274
-1
-select count(*) from t3 where num>7000000;
-count(*)
-1847274
-select count(*) from t3 where num>7000000;
-count(*)
-1847274
-select count(*) from t3 where num>7000000;
-count(*)
-1847274
-select count(*) from t3 where num>7000000;
-count(*)
-1847274
-select count(*) from t3 where num>7000000;
-count(*)
-1847274
-select count(*) from t3 where num>7000000;
-count(*)
-1847274
-select count(*) from t3 where num>7000000;
-count(*)
-1847274
-select count(*) from t3 where num>7000000;
-count(*)
-1847274
-select count(*) from t3 where num>7000000;
-count(*)
-1847274
-select count(*) from t3 where num>7000000;
-count(*)
-1847274
-1
-drop table if exists t,t1,t2,t3;
diff --git a/mysql-test/suite/tokudb.bugs/t/part_index_scan.test b/mysql-test/suite/tokudb.bugs/t/part_index_scan.test
deleted file mode 100644
index b38a979752b..00000000000
--- a/mysql-test/suite/tokudb.bugs/t/part_index_scan.test
+++ /dev/null
@@ -1,157 +0,0 @@
-# verify that index scans on parititions are not slow
-# due to tokudb bulk fetch not being used
-
-source include/have_tokudb.inc;
-source include/have_partition.inc;
-source include/big_test.inc;
-set default_storage_engine='tokudb';
-disable_warnings;
-drop table if exists t,t1,t2,t3;
-enable_warnings;
-
-let $debug = 0;
-let $maxq = 10;
-
-CREATE TABLE `t` (
- `num` int(10) unsigned auto_increment NOT NULL,
- `val` varchar(32) DEFAULT NULL,
- PRIMARY KEY (`num`)
-);
-
-# put 8M rows into t
-if ($debug) { let $ts = `select now()`; echo "start $ts"; }
-INSERT INTO t values (null,null);
-INSERT INTO t SELECT null,null FROM t;
-INSERT INTO t SELECT null,null FROM t;
-INSERT INTO t SELECT null,null FROM t;
-INSERT INTO t SELECT null,null FROM t;
-INSERT INTO t SELECT null,null FROM t;
-INSERT INTO t SELECT null,null FROM t;
-INSERT INTO t SELECT null,null FROM t;
-INSERT INTO t SELECT null,null FROM t;
-INSERT INTO t SELECT null,null FROM t;
-INSERT INTO t SELECT null,null FROM t;
-INSERT INTO t SELECT null,null FROM t;
-INSERT INTO t SELECT null,null FROM t;
-INSERT INTO t SELECT null,null FROM t;
-INSERT INTO t SELECT null,null FROM t;
-INSERT INTO t SELECT null,null FROM t;
-INSERT INTO t SELECT null,null FROM t;
-INSERT INTO t SELECT null,null FROM t;
-INSERT INTO t SELECT null,null FROM t;
-INSERT INTO t SELECT null,null FROM t;
-INSERT INTO t SELECT null,null FROM t;
-INSERT INTO t SELECT null,null FROM t;
-INSERT INTO t SELECT null,null FROM t;
-INSERT INTO t SELECT null,null FROM t;
-if ($debug) { let $ts = `select now()`; echo "select $ts"; }
-SELECT count(*) FROM t;
-if ($debug) { let $ts = `select now()`; echo "select done $ts"; }
-
-CREATE TABLE `t1` (
- `num` int(10) unsigned NOT NULL,
- `val` varchar(32) DEFAULT NULL,
- PRIMARY KEY (`num`)
-);
-
-CREATE TABLE `t2` (
- `num` int(10) unsigned NOT NULL,
- `val` varchar(32) DEFAULT NULL,
- PRIMARY KEY (`num`)
-)
-PARTITION BY HASH (num) PARTITIONS 10;
-
-CREATE TABLE `t3` (
- `num` int(10) unsigned NOT NULL,
- `val` varchar(32) DEFAULT NULL,
- PRIMARY KEY (`num`)
-)
-PARTITION BY RANGE (num)
-(PARTITION p0 VALUES LESS THAN (1000000),
- PARTITION p1 VALUES LESS THAN (2000000),
- PARTITION p2 VALUES LESS THAN (3000000),
- PARTITION p3 VALUES LESS THAN (4000000),
- PARTITION p4 VALUES LESS THAN (5000000),
- PARTITION p5 VALUES LESS THAN (6000000),
- PARTITION p6 VALUES LESS THAN (7000000),
- PARTITION p7 VALUES LESS THAN (8000000),
- PARTITION px VALUES LESS THAN MAXVALUE);
-
-if ($debug) { let $ts = `select now()`; echo "insert t1 $ts"; }
-insert into t1 select * from t;
-if ($debug) { let $ts = `select now()`; echo "insert t2 $ts"; }
-insert into t2 select * from t;
-if ($debug) { let $ts = `select now()`; echo "insert t3 $ts"; }
-insert into t3 select * from t;
-if ($debug) { let $ts = `select now()`; echo "select t1 $ts"; }
-
-# verify that full index scans on partitioned tables t2 and t3 are comparable to a non-partitioned table t1
-let $s = `select to_seconds(now())`;
-let $i = 0;
-while ($i < $maxq) {
- select count(*) from t1;
- inc $i;
-}
-let $t1 = `select to_seconds(now()) - $s`;
-
-if ($debug) { let $ts = `select now()`; echo "select t2 $ts"; }
-
-let $s = `select to_seconds(now())`;
-let $i = 0;
-while ($i < $maxq) {
- select count(*) from t2;
- inc $i;
-}
-let $t2 = `select to_seconds(now()) - $s`;
-let $d = `select abs($t2 - $t1) <= $t1`;
-echo $d;
-
-if ($debug) { let $ts = `select now()`; echo "select t3 $ts"; }
-
-let $s = `select to_seconds(now())`;
-let $i = 0;
-while ($i < $maxq) {
- select count(*) from t3;
- inc $i;
-}
-let $t3 = `select to_seconds(now()) - $s`;
-let $d = `select abs($t3 - $t1) <= $t1`;
-echo $d;
-
-if ($debug) { let $ts = `select now()`; echo "select t1 $ts"; }
-
-let $s = `select to_seconds(now())`;
-let $i = 0;
-while ($i < $maxq) {
- select count(*) from t1 where num>7000000;
- inc $i;
-}
-let $t1 = `select to_seconds(now()) - $s`;
-
-if ($debug) { let $ts = `select now()`; echo "select t2 $ts"; }
-
-let $s = `select to_seconds(now())`;
-let $i = 0;
-while ($i < $maxq) {
- select count(*) from t2 where num>7000000;
- inc $i;
-}
-let $t2 = `select to_seconds(now()) - $s`;
-let $d = `select abs($t2 - $t1) <= $t1`;
-echo $d;
-
-if ($debug) { let $ts = `select now()`; echo "select t3 $ts"; }
-
-let $s = `select to_seconds(now())`;
-let $i = 0;
-while ($i < $maxq) {
- select count(*) from t3 where num>7000000;
- inc $i;
-}
-let $t3 = `select to_seconds(now()) - $s`;
-let $d = `select abs($t3 - $t1) <= $t1`;
-echo $d;
-
-if ($debug) { let $ts = `select now()`; echo "done $ts"; }
-
-drop table if exists t,t1,t2,t3;
diff --git a/mysql-test/suite/tokudb/r/bf_create_select_nonpart.result b/mysql-test/suite/tokudb/r/bf_create_select.result
index adacf1ed6aa..adacf1ed6aa 100644
--- a/mysql-test/suite/tokudb/r/bf_create_select_nonpart.result
+++ b/mysql-test/suite/tokudb/r/bf_create_select.result
diff --git a/mysql-test/suite/tokudb/r/bf_create_temp_select_nonpart.result b/mysql-test/suite/tokudb/r/bf_create_temp_select.result
index 6eddfaa9e82..6eddfaa9e82 100644
--- a/mysql-test/suite/tokudb/r/bf_create_temp_select_nonpart.result
+++ b/mysql-test/suite/tokudb/r/bf_create_temp_select.result
diff --git a/mysql-test/suite/tokudb/r/bf_delete_nonpart.result b/mysql-test/suite/tokudb/r/bf_delete.result
index e83b150c543..e83b150c543 100644
--- a/mysql-test/suite/tokudb/r/bf_delete_nonpart.result
+++ b/mysql-test/suite/tokudb/r/bf_delete.result
diff --git a/mysql-test/suite/tokudb/r/bf_insert_select_nonpart.result b/mysql-test/suite/tokudb/r/bf_insert_select.result
index ba7d0f63cd6..ba7d0f63cd6 100644
--- a/mysql-test/suite/tokudb/r/bf_insert_select_nonpart.result
+++ b/mysql-test/suite/tokudb/r/bf_insert_select.result
diff --git a/mysql-test/suite/tokudb/r/bf_insert_select_dup_key_nonpart.result b/mysql-test/suite/tokudb/r/bf_insert_select_dup_key.result
index 22e2846d181..22e2846d181 100644
--- a/mysql-test/suite/tokudb/r/bf_insert_select_dup_key_nonpart.result
+++ b/mysql-test/suite/tokudb/r/bf_insert_select_dup_key.result
diff --git a/mysql-test/suite/tokudb/r/bf_replace_select_nonpart.result b/mysql-test/suite/tokudb/r/bf_replace_select.result
index eab0f103ed6..eab0f103ed6 100644
--- a/mysql-test/suite/tokudb/r/bf_replace_select_nonpart.result
+++ b/mysql-test/suite/tokudb/r/bf_replace_select.result
diff --git a/mysql-test/suite/tokudb/r/bf_select_hash_part.result b/mysql-test/suite/tokudb/r/bf_select_hash_part.result
new file mode 100644
index 00000000000..2c72c7129db
--- /dev/null
+++ b/mysql-test/suite/tokudb/r/bf_select_hash_part.result
@@ -0,0 +1,278 @@
+set default_storage_engine='tokudb';
+drop table if exists t;
+CREATE TABLE `t` (
+`num` int(10) unsigned NOT NULL auto_increment,
+`val` varchar(32) DEFAULT NULL,
+PRIMARY KEY (`num`)
+) PARTITION BY HASH (num) PARTITIONS 8;
+INSERT INTO t values (null,null);
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+SELECT count(*) FROM t;
+count(*)
+1048576
+set tokudb_bulk_fetch=ON;
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+set tokudb_bulk_fetch=OFF;
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+1
+set tokudb_bulk_fetch=ON;
+SELECT count(*) from t where num > 500000;
+count(*)
+548576
+SELECT count(*) from t where num > 500000;
+count(*)
+548576
+SELECT count(*) from t where num > 500000;
+count(*)
+548576
+SELECT count(*) from t where num > 500000;
+count(*)
+548576
+SELECT count(*) from t where num > 500000;
+count(*)
+548576
+SELECT count(*) from t where num > 500000;
+count(*)
+548576
+SELECT count(*) from t where num > 500000;
+count(*)
+548576
+SELECT count(*) from t where num > 500000;
+count(*)
+548576
+SELECT count(*) from t where num > 500000;
+count(*)
+548576
+SELECT count(*) from t where num > 500000;
+count(*)
+548576
+SELECT count(*) from t where num > 500000;
+count(*)
+548576
+SELECT count(*) from t where num > 500000;
+count(*)
+548576
+SELECT count(*) from t where num > 500000;
+count(*)
+548576
+SELECT count(*) from t where num > 500000;
+count(*)
+548576
+SELECT count(*) from t where num > 500000;
+count(*)
+548576
+SELECT count(*) from t where num > 500000;
+count(*)
+548576
+SELECT count(*) from t where num > 500000;
+count(*)
+548576
+SELECT count(*) from t where num > 500000;
+count(*)
+548576
+SELECT count(*) from t where num > 500000;
+count(*)
+548576
+SELECT count(*) from t where num > 500000;
+count(*)
+548576
+set tokudb_bulk_fetch=OFF;
+SELECT count(*) from t where num > 500000;
+count(*)
+548576
+SELECT count(*) from t where num > 500000;
+count(*)
+548576
+SELECT count(*) from t where num > 500000;
+count(*)
+548576
+SELECT count(*) from t where num > 500000;
+count(*)
+548576
+SELECT count(*) from t where num > 500000;
+count(*)
+548576
+SELECT count(*) from t where num > 500000;
+count(*)
+548576
+SELECT count(*) from t where num > 500000;
+count(*)
+548576
+SELECT count(*) from t where num > 500000;
+count(*)
+548576
+SELECT count(*) from t where num > 500000;
+count(*)
+548576
+SELECT count(*) from t where num > 500000;
+count(*)
+548576
+SELECT count(*) from t where num > 500000;
+count(*)
+548576
+SELECT count(*) from t where num > 500000;
+count(*)
+548576
+SELECT count(*) from t where num > 500000;
+count(*)
+548576
+SELECT count(*) from t where num > 500000;
+count(*)
+548576
+SELECT count(*) from t where num > 500000;
+count(*)
+548576
+SELECT count(*) from t where num > 500000;
+count(*)
+548576
+SELECT count(*) from t where num > 500000;
+count(*)
+548576
+SELECT count(*) from t where num > 500000;
+count(*)
+548576
+SELECT count(*) from t where num > 500000;
+count(*)
+548576
+SELECT count(*) from t where num > 500000;
+count(*)
+548576
+1
+drop table t;
diff --git a/mysql-test/suite/tokudb/r/bf_select_part.result b/mysql-test/suite/tokudb/r/bf_select_part.result
deleted file mode 100644
index f36fc0e1ce3..00000000000
--- a/mysql-test/suite/tokudb/r/bf_select_part.result
+++ /dev/null
@@ -1,543 +0,0 @@
-set default_storage_engine='tokudb';
-drop table if exists t,t1,t2,t3;
-CREATE TABLE `t` (
-`num` int(10) unsigned auto_increment NOT NULL,
-`val` varchar(32) DEFAULT NULL,
-PRIMARY KEY (`num`)
-);
-INSERT INTO t values (null,null);
-INSERT INTO t SELECT null,val FROM t;
-INSERT INTO t SELECT null,val FROM t;
-INSERT INTO t SELECT null,val FROM t;
-INSERT INTO t SELECT null,val FROM t;
-INSERT INTO t SELECT null,val FROM t;
-INSERT INTO t SELECT null,val FROM t;
-INSERT INTO t SELECT null,val FROM t;
-INSERT INTO t SELECT null,val FROM t;
-INSERT INTO t SELECT null,val FROM t;
-INSERT INTO t SELECT null,val FROM t;
-INSERT INTO t SELECT null,val FROM t;
-INSERT INTO t SELECT null,val FROM t;
-INSERT INTO t SELECT null,val FROM t;
-INSERT INTO t SELECT null,val FROM t;
-INSERT INTO t SELECT null,val FROM t;
-INSERT INTO t SELECT null,val FROM t;
-INSERT INTO t SELECT null,val FROM t;
-INSERT INTO t SELECT null,val FROM t;
-INSERT INTO t SELECT null,val FROM t;
-INSERT INTO t SELECT null,val FROM t;
-INSERT INTO t SELECT null,val FROM t;
-INSERT INTO t SELECT null,val FROM t;
-INSERT INTO t SELECT null,val FROM t;
-SELECT count(*) FROM t;
-count(*)
-8388608
-CREATE TABLE `t1` (
-`num` int(10) unsigned NOT NULL,
-`val` varchar(32) DEFAULT NULL,
-PRIMARY KEY (`num`)
-) as select * from t;
-CREATE TABLE `t2` (
-`num` int(10) unsigned NOT NULL,
-`val` varchar(32) DEFAULT NULL,
-PRIMARY KEY (`num`)
-) PARTITION BY HASH (num)
-PARTITIONS 8 as select * from t;
-CREATE TABLE `t3` (
-`num` int(10) unsigned NOT NULL,
-`val` varchar(32) DEFAULT NULL,
-PRIMARY KEY (`num`)
-) PARTITION BY RANGE (num)
-(PARTITION p0 VALUES LESS THAN (1000000),
-PARTITION p1 VALUES LESS THAN (2000000),
-PARTITION p2 VALUES LESS THAN (3000000),
-PARTITION p3 VALUES LESS THAN (4000000),
-PARTITION p4 VALUES LESS THAN (5000000),
-PARTITION p5 VALUES LESS THAN (6000000),
-PARTITION p6 VALUES LESS THAN (7000000),
-PARTITION p7 VALUES LESS THAN MAXVALUE) as select * from t;
-SELECT count(*) from t1;
-count(*)
-8388608
-SELECT count(*) from t1;
-count(*)
-8388608
-SELECT count(*) from t1;
-count(*)
-8388608
-SELECT count(*) from t1;
-count(*)
-8388608
-SELECT count(*) from t1;
-count(*)
-8388608
-SELECT count(*) from t1;
-count(*)
-8388608
-SELECT count(*) from t1;
-count(*)
-8388608
-SELECT count(*) from t1;
-count(*)
-8388608
-SELECT count(*) from t1;
-count(*)
-8388608
-SELECT count(*) from t1;
-count(*)
-8388608
-SELECT count(*) from t2;
-count(*)
-8388608
-SELECT count(*) from t2;
-count(*)
-8388608
-SELECT count(*) from t2;
-count(*)
-8388608
-SELECT count(*) from t2;
-count(*)
-8388608
-SELECT count(*) from t2;
-count(*)
-8388608
-SELECT count(*) from t2;
-count(*)
-8388608
-SELECT count(*) from t2;
-count(*)
-8388608
-SELECT count(*) from t2;
-count(*)
-8388608
-SELECT count(*) from t2;
-count(*)
-8388608
-SELECT count(*) from t2;
-count(*)
-8388608
-1
-SELECT count(*) from t1;
-count(*)
-8388608
-SELECT count(*) from t1;
-count(*)
-8388608
-SELECT count(*) from t1;
-count(*)
-8388608
-SELECT count(*) from t1;
-count(*)
-8388608
-SELECT count(*) from t1;
-count(*)
-8388608
-SELECT count(*) from t1;
-count(*)
-8388608
-SELECT count(*) from t1;
-count(*)
-8388608
-SELECT count(*) from t1;
-count(*)
-8388608
-SELECT count(*) from t1;
-count(*)
-8388608
-SELECT count(*) from t1;
-count(*)
-8388608
-SELECT count(*) from t3;
-count(*)
-8388608
-SELECT count(*) from t3;
-count(*)
-8388608
-SELECT count(*) from t3;
-count(*)
-8388608
-SELECT count(*) from t3;
-count(*)
-8388608
-SELECT count(*) from t3;
-count(*)
-8388608
-SELECT count(*) from t3;
-count(*)
-8388608
-SELECT count(*) from t3;
-count(*)
-8388608
-SELECT count(*) from t3;
-count(*)
-8388608
-SELECT count(*) from t3;
-count(*)
-8388608
-SELECT count(*) from t3;
-count(*)
-8388608
-1
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t2 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t2 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t2 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t2 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t2 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t2 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t2 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t2 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t2 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t2 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t2 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t2 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t2 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t2 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t2 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t2 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t2 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t2 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t2 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t2 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t2 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t2 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t2 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t2 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t2 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t2 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t2 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t2 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t2 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t2 where num > 7000000;
-count(*)
-1847274
-1
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t3 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t3 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t3 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t3 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t3 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t3 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t3 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t3 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t3 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t3 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t3 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t3 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t3 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t3 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t3 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t3 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t3 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t3 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t3 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t3 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t3 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t3 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t3 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t3 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t3 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t3 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t3 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t3 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t3 where num > 7000000;
-count(*)
-1847274
-SELECT count(*) from t3 where num > 7000000;
-count(*)
-1847274
-1
-drop table t,t1,t2,t3;
diff --git a/mysql-test/suite/tokudb/r/bf_select_range_part.result b/mysql-test/suite/tokudb/r/bf_select_range_part.result
new file mode 100644
index 00000000000..c13324aa34e
--- /dev/null
+++ b/mysql-test/suite/tokudb/r/bf_select_range_part.result
@@ -0,0 +1,286 @@
+set default_storage_engine='tokudb';
+drop table if exists t;
+CREATE TABLE `t` (
+`num` int(10) unsigned NOT NULL auto_increment,
+`val` varchar(32) DEFAULT NULL,
+PRIMARY KEY (`num`)
+) PARTITION BY RANGE (num)
+(PARTITION p0 VALUES LESS THAN (100000),
+PARTITION p1 VALUES LESS THAN (200000),
+PARTITION p2 VALUES LESS THAN (300000),
+PARTITION p3 VALUES LESS THAN (400000),
+PARTITION p4 VALUES LESS THAN (500000),
+PARTITION p5 VALUES LESS THAN (600000),
+PARTITION p6 VALUES LESS THAN (700000),
+PARTITION p7 VALUES LESS THAN MAXVALUE);
+INSERT INTO t values (null,null);
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+SELECT count(*) FROM t;
+count(*)
+1048576
+set tokudb_bulk_fetch=ON;
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+set tokudb_bulk_fetch=OFF;
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+SELECT count(*) from t;
+count(*)
+1048576
+1
+set tokudb_bulk_fetch=ON;
+SELECT count(*) from t where num > 700000;
+count(*)
+348576
+SELECT count(*) from t where num > 700000;
+count(*)
+348576
+SELECT count(*) from t where num > 700000;
+count(*)
+348576
+SELECT count(*) from t where num > 700000;
+count(*)
+348576
+SELECT count(*) from t where num > 700000;
+count(*)
+348576
+SELECT count(*) from t where num > 700000;
+count(*)
+348576
+SELECT count(*) from t where num > 700000;
+count(*)
+348576
+SELECT count(*) from t where num > 700000;
+count(*)
+348576
+SELECT count(*) from t where num > 700000;
+count(*)
+348576
+SELECT count(*) from t where num > 700000;
+count(*)
+348576
+SELECT count(*) from t where num > 700000;
+count(*)
+348576
+SELECT count(*) from t where num > 700000;
+count(*)
+348576
+SELECT count(*) from t where num > 700000;
+count(*)
+348576
+SELECT count(*) from t where num > 700000;
+count(*)
+348576
+SELECT count(*) from t where num > 700000;
+count(*)
+348576
+SELECT count(*) from t where num > 700000;
+count(*)
+348576
+SELECT count(*) from t where num > 700000;
+count(*)
+348576
+SELECT count(*) from t where num > 700000;
+count(*)
+348576
+SELECT count(*) from t where num > 700000;
+count(*)
+348576
+SELECT count(*) from t where num > 700000;
+count(*)
+348576
+set tokudb_bulk_fetch=OFF;
+SELECT count(*) from t where num > 700000;
+count(*)
+348576
+SELECT count(*) from t where num > 700000;
+count(*)
+348576
+SELECT count(*) from t where num > 700000;
+count(*)
+348576
+SELECT count(*) from t where num > 700000;
+count(*)
+348576
+SELECT count(*) from t where num > 700000;
+count(*)
+348576
+SELECT count(*) from t where num > 700000;
+count(*)
+348576
+SELECT count(*) from t where num > 700000;
+count(*)
+348576
+SELECT count(*) from t where num > 700000;
+count(*)
+348576
+SELECT count(*) from t where num > 700000;
+count(*)
+348576
+SELECT count(*) from t where num > 700000;
+count(*)
+348576
+SELECT count(*) from t where num > 700000;
+count(*)
+348576
+SELECT count(*) from t where num > 700000;
+count(*)
+348576
+SELECT count(*) from t where num > 700000;
+count(*)
+348576
+SELECT count(*) from t where num > 700000;
+count(*)
+348576
+SELECT count(*) from t where num > 700000;
+count(*)
+348576
+SELECT count(*) from t where num > 700000;
+count(*)
+348576
+SELECT count(*) from t where num > 700000;
+count(*)
+348576
+SELECT count(*) from t where num > 700000;
+count(*)
+348576
+SELECT count(*) from t where num > 700000;
+count(*)
+348576
+SELECT count(*) from t where num > 700000;
+count(*)
+348576
+1
+drop table t;
diff --git a/mysql-test/suite/tokudb/t/bf_create_select_nonpart.test b/mysql-test/suite/tokudb/t/bf_create_select.test
index a8b7f9c9f6a..a8b7f9c9f6a 100644
--- a/mysql-test/suite/tokudb/t/bf_create_select_nonpart.test
+++ b/mysql-test/suite/tokudb/t/bf_create_select.test
diff --git a/mysql-test/suite/tokudb/t/bf_create_temp_select_nonpart.test b/mysql-test/suite/tokudb/t/bf_create_temp_select.test
index fdd665076c9..fdd665076c9 100644
--- a/mysql-test/suite/tokudb/t/bf_create_temp_select_nonpart.test
+++ b/mysql-test/suite/tokudb/t/bf_create_temp_select.test
diff --git a/mysql-test/suite/tokudb/t/bf_delete_nonpart.test b/mysql-test/suite/tokudb/t/bf_delete.test
index 65b26df230e..65b26df230e 100644
--- a/mysql-test/suite/tokudb/t/bf_delete_nonpart.test
+++ b/mysql-test/suite/tokudb/t/bf_delete.test
diff --git a/mysql-test/suite/tokudb/t/bf_insert_select_nonpart.test b/mysql-test/suite/tokudb/t/bf_insert_select.test
index 11f14013a30..11f14013a30 100644
--- a/mysql-test/suite/tokudb/t/bf_insert_select_nonpart.test
+++ b/mysql-test/suite/tokudb/t/bf_insert_select.test
diff --git a/mysql-test/suite/tokudb/t/bf_insert_select_dup_key_nonpart.test b/mysql-test/suite/tokudb/t/bf_insert_select_dup_key.test
index 3200beeaba9..3200beeaba9 100644
--- a/mysql-test/suite/tokudb/t/bf_insert_select_dup_key_nonpart.test
+++ b/mysql-test/suite/tokudb/t/bf_insert_select_dup_key.test
diff --git a/mysql-test/suite/tokudb/t/bf_replace_select_nonpart.test b/mysql-test/suite/tokudb/t/bf_replace_select.test
index 380eb5adda8..380eb5adda8 100644
--- a/mysql-test/suite/tokudb/t/bf_replace_select_nonpart.test
+++ b/mysql-test/suite/tokudb/t/bf_replace_select.test
diff --git a/mysql-test/suite/tokudb/t/bf_select_hash_part.test b/mysql-test/suite/tokudb/t/bf_select_hash_part.test
new file mode 100644
index 00000000000..67fefcb45bd
--- /dev/null
+++ b/mysql-test/suite/tokudb/t/bf_select_hash_part.test
@@ -0,0 +1,100 @@
+# Verify that index and range scans on a hash partitioned tokudb table are not slow on tables
+# due to tokudb bulk fetch not being used.
+
+source include/have_tokudb.inc;
+source include/have_partition.inc;
+source include/big_test.inc;
+set default_storage_engine='tokudb';
+disable_warnings;
+drop table if exists t;
+enable_warnings;
+
+let $maxq = 20;
+let $debug = 0;
+
+# create the hash partition table
+CREATE TABLE `t` (
+ `num` int(10) unsigned NOT NULL auto_increment,
+ `val` varchar(32) DEFAULT NULL,
+ PRIMARY KEY (`num`)
+) PARTITION BY HASH (num) PARTITIONS 8;
+
+# put 1M rows into t
+INSERT INTO t values (null,null);
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+SELECT count(*) FROM t;
+
+set tokudb_bulk_fetch=ON;
+let $s = `select unix_timestamp()`;
+let $i = 0;
+while ($i < $maxq) {
+ SELECT count(*) from t;
+ inc $i;
+}
+let $time_bf_on = `select unix_timestamp() - $s`;
+
+if ($debug) { echo index scans took $time_bf_on; }
+
+set tokudb_bulk_fetch=OFF;
+let $s = `select unix_timestamp()`;
+let $i = 0;
+while ($i < $maxq) {
+ SELECT count(*) from t;
+ inc $i;
+}
+let $time_bf_off = `select unix_timestamp() - $s`;
+
+if ($debug) { echo index scans took $time_bf_off.; }
+
+# check that the scan time with bulk fetch off is at least 1.5 times as long as with bulk fetch on
+let $verdict = `select $time_bf_off > $time_bf_on && $time_bf_off >= 1.5 * $time_bf_on`;
+echo $verdict;
+if (!$verdict) { echo index scan $time_bf_on $time_bf_off; }
+
+set tokudb_bulk_fetch=ON;
+let $s = `select unix_timestamp()`;
+let $i = 0;
+while ($i < $maxq) {
+ SELECT count(*) from t where num > 500000;
+ inc $i;
+}
+let $time_bf_on = `select unix_timestamp() - $s`;
+
+if ($debug) { echo range scans took $time_bf_on; }
+
+set tokudb_bulk_fetch=OFF;
+let $s = `select unix_timestamp()`;
+let $i = 0;
+while ($i < $maxq) {
+ SELECT count(*) from t where num > 500000;
+ inc $i;
+}
+let $time_bf_off = `select unix_timestamp() - $s`;
+
+if ($debug) { echo range scans took $time_bf_off.; }
+
+# check that the scan time with bulk fetch off is at least 1.5 times as long as with bulk fetch on
+let $verdict = `select $time_bf_off > $time_bf_on && $time_bf_off >= 1.5 * $time_bf_on`;
+echo $verdict;
+if (!$verdict) { echo range scan $time_bf_on $time_bf_off; }
+
+drop table t;
diff --git a/mysql-test/suite/tokudb/t/bf_select_part.test b/mysql-test/suite/tokudb/t/bf_select_part.test
deleted file mode 100644
index d9faa4b0bb2..00000000000
--- a/mysql-test/suite/tokudb/t/bf_select_part.test
+++ /dev/null
@@ -1,220 +0,0 @@
-# Verify that index and range scans are not slow
-# on tables during create select statements
-# against hash and range partitioned tables
-# due to tokudb bulk fetch not being used
-
-source include/have_tokudb.inc;
-source include/have_partition.inc;
-source include/big_test.inc;
-set default_storage_engine='tokudb';
-disable_warnings;
-drop table if exists t,t1,t2,t3;
-enable_warnings;
-
-let $maxq = 10;
-
-CREATE TABLE `t` (
- `num` int(10) unsigned auto_increment NOT NULL,
- `val` varchar(32) DEFAULT NULL,
- PRIMARY KEY (`num`)
-);
-
-# put 8M rows into t
-INSERT INTO t values (null,null);
-INSERT INTO t SELECT null,val FROM t;
-INSERT INTO t SELECT null,val FROM t;
-INSERT INTO t SELECT null,val FROM t;
-INSERT INTO t SELECT null,val FROM t;
-INSERT INTO t SELECT null,val FROM t;
-INSERT INTO t SELECT null,val FROM t;
-INSERT INTO t SELECT null,val FROM t;
-INSERT INTO t SELECT null,val FROM t;
-INSERT INTO t SELECT null,val FROM t;
-INSERT INTO t SELECT null,val FROM t;
-INSERT INTO t SELECT null,val FROM t;
-INSERT INTO t SELECT null,val FROM t;
-INSERT INTO t SELECT null,val FROM t;
-INSERT INTO t SELECT null,val FROM t;
-INSERT INTO t SELECT null,val FROM t;
-INSERT INTO t SELECT null,val FROM t;
-INSERT INTO t SELECT null,val FROM t;
-INSERT INTO t SELECT null,val FROM t;
-INSERT INTO t SELECT null,val FROM t;
-INSERT INTO t SELECT null,val FROM t;
-INSERT INTO t SELECT null,val FROM t;
-INSERT INTO t SELECT null,val FROM t;
-INSERT INTO t SELECT null,val FROM t;
-SELECT count(*) FROM t;
-
-# Create first table from source table t
-CREATE TABLE `t1` (
- `num` int(10) unsigned NOT NULL,
- `val` varchar(32) DEFAULT NULL,
- PRIMARY KEY (`num`)
-) as select * from t;
-
-# Create second table from source table t
-CREATE TABLE `t2` (
- `num` int(10) unsigned NOT NULL,
- `val` varchar(32) DEFAULT NULL,
- PRIMARY KEY (`num`)
-) PARTITION BY HASH (num)
-PARTITIONS 8 as select * from t;
-
-# Create third table from source table t;
-CREATE TABLE `t3` (
- `num` int(10) unsigned NOT NULL,
- `val` varchar(32) DEFAULT NULL,
- PRIMARY KEY (`num`)
-) PARTITION BY RANGE (num)
-(PARTITION p0 VALUES LESS THAN (1000000),
- PARTITION p1 VALUES LESS THAN (2000000),
- PARTITION p2 VALUES LESS THAN (3000000),
- PARTITION p3 VALUES LESS THAN (4000000),
- PARTITION p4 VALUES LESS THAN (5000000),
- PARTITION p5 VALUES LESS THAN (6000000),
- PARTITION p6 VALUES LESS THAN (7000000),
- PARTITION p7 VALUES LESS THAN MAXVALUE) as select * from t;
-
-
-let $s = `select to_seconds(now())`;
-let $i = 0;
-while ($i < $maxq) {
- SELECT count(*) from t1;
- inc $i;
-}
-let $time_elapsed_select = `select to_seconds(now()) - $s`;
-
-# The following line can be used to display the time elapsed data
-# which could be useful for debugging.
-# echo Index scans took $time_elapsed_select seconds.;
-
-let $s = `select to_seconds(now())`;
-let $i = 0;
-while ($i < $maxq) {
- SELECT count(*) from t2;
- inc $i;
-}
-
-let $time_elapsed_select_hash = `select to_seconds(now()) - $s`;
-
-# The following line can be used to display the time elapsed data
-# which could be useful for debugging.
-# echo Index scans took $time_elapsed_select_hash seconds.;
-
-# This check evaluates whether the time elapsed during the select statement
-# against a hashed partition table is on par with the select statment
-# against a non-partitioned table, which will confirm that bulk fetch is in fact being used.
-let $verdict = `select abs($time_elapsed_select_hash - $time_elapsed_select) <= $time_elapsed_select`;
-echo $verdict;
-if (!$verdict) { echo index scan t2 $time_elapsed_select_hash $time_elapsed_select; }
-
-######################################################################
-
-let $s = `select to_seconds(now())`;
-let $i = 0;
-while ($i < $maxq) {
- SELECT count(*) from t1;
- inc $i;
-}
-let $time_elapsed_select = `select to_seconds(now()) - $s`;
-
-# The following line can be used to display the time elapsed data
-# which could be useful for debugging.
-#echo Index scans took $time_elapsed_select seconds.;
-
-let $s = `select to_seconds(now())`;
-let $i = 0;
-while ($i < $maxq) {
- SELECT count(*) from t3;
- inc $i;
-}
-
-let $time_elapsed_select_range = `select to_seconds(now()) - $s`;
-
-# The following line can be used to display the time elapsed data
-# which could be useful for debugging.
-#echo Index scans took $time_elapsed_select_range seconds.;
-
-# This check evaluates whether the time elapsed during the select statement
-# against a range partition table is on par with the select statment
-# against a non-partitioned table, which will confirm that bulk fetch is in fact being used.
-let $verdict = `select abs($time_elapsed_select_range - $time_elapsed_select) <= $time_elapsed_select`;
-echo $verdict;
-if (!$verdict) { echo index scan t3 $time_elapsed_select_range $time_elapsed_select; }
-
-#########################################################################
-
-let $maxrq = 30;
-
-let $s = `select to_seconds(now())`;
-let $i = 0;
-while ($i < $maxrq) {
- SELECT count(*) from t1 where num > 7000000;
- inc $i;
-}
-let $time_elapsed_select = `select to_seconds(now()) - $s`;
-
-# The following line can be used to display the time elapsed data
-# which could be useful for debugging.
-#echo Index scans took $time_elapsed_select seconds.;
-
-let $s = `select to_seconds(now())`;
-let $i = 0;
-while ($i < $maxrq) {
- SELECT count(*) from t2 where num > 7000000;
- inc $i;
-}
-
-let $time_elapsed_select_hash = `select to_seconds(now()) - $s`;
-
-# The following line can be used to display the time elapsed data
-# which could be useful for debugging.
-#echo Index scans took $time_elapsed_select_hash seconds.;
-
-
-# This check evaluates whether the time elapsed during the select statement
-# against a hash partition table is on par with the select statment
-# against a non-partitioned table, which will confirm that bulk fetch is in fact being used.
-let $verdict = `select abs($time_elapsed_select_hash - $time_elapsed_select) <= $time_elapsed_select`;
-echo $verdict;
-if (!$verdict) { echo range scan t2 $time_elapsed_select_hash $time_elapsed_select; }
-
-#########################################################################
-
-let $maxrq = 30;
-
-let $s = `select to_seconds(now())`;
-let $i = 0;
-while ($i < $maxrq) {
- SELECT count(*) from t1 where num > 7000000;
- inc $i;
-}
-let $time_elapsed_select = `select to_seconds(now()) - $s`;
-
-# The following line can be used to display the time elapsed data
-# which could be useful for debugging.
-#echo Index scans took $time_elapsed_select seconds.;
-
-let $s = `select to_seconds(now())`;
-let $i = 0;
-while ($i < $maxrq) {
- SELECT count(*) from t3 where num > 7000000;
- inc $i;
-}
-
-let $time_elapsed_select_range = `select to_seconds(now()) - $s`;
-
-# The following line can be used to display the time elapsed data
-# which could be useful for debugging.
-#echo Index scans took $time_elapsed_select_range seconds.;
-
-
-# This check evaluates whether the time elapsed during the select statement
-# against a range partition table is on par with the select statment
-# against a non-partitioned table, which will confirm that bulk fetch is in fact being used.
-let $verdict = `select abs($time_elapsed_select_range - $time_elapsed_select) <= $time_elapsed_select`;
-echo $verdict;
-if (!$verdict) { echo range scan t3 $time_elapsed_select_range $time_elapsed_select; }
-
-drop table t,t1,t2,t3;
diff --git a/mysql-test/suite/tokudb/t/bf_select_range_part.test b/mysql-test/suite/tokudb/t/bf_select_range_part.test
new file mode 100644
index 00000000000..0a1d7de3747
--- /dev/null
+++ b/mysql-test/suite/tokudb/t/bf_select_range_part.test
@@ -0,0 +1,108 @@
+# Verify that index and range scans on a range partitioned tokudb table are not slow on tables
+# due to tokudb bulk fetch not being used.
+
+source include/have_tokudb.inc;
+source include/have_partition.inc;
+source include/big_test.inc;
+set default_storage_engine='tokudb';
+disable_warnings;
+drop table if exists t;
+enable_warnings;
+
+let $maxq = 20;
+let $debug = 0;
+
+# create the range partition table
+CREATE TABLE `t` (
+ `num` int(10) unsigned NOT NULL auto_increment,
+ `val` varchar(32) DEFAULT NULL,
+ PRIMARY KEY (`num`)
+) PARTITION BY RANGE (num)
+(PARTITION p0 VALUES LESS THAN (100000),
+ PARTITION p1 VALUES LESS THAN (200000),
+ PARTITION p2 VALUES LESS THAN (300000),
+ PARTITION p3 VALUES LESS THAN (400000),
+ PARTITION p4 VALUES LESS THAN (500000),
+ PARTITION p5 VALUES LESS THAN (600000),
+ PARTITION p6 VALUES LESS THAN (700000),
+ PARTITION p7 VALUES LESS THAN MAXVALUE);
+
+# put 1M rows into t
+INSERT INTO t values (null,null);
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+INSERT INTO t SELECT null,val FROM t;
+SELECT count(*) FROM t;
+
+set tokudb_bulk_fetch=ON;
+let $s = `select unix_timestamp()`;
+let $i = 0;
+while ($i < $maxq) {
+ SELECT count(*) from t;
+ inc $i;
+}
+let $time_bf_on = `select unix_timestamp() - $s`;
+
+if ($debug) { echo index scans took $time_bf_on; }
+
+set tokudb_bulk_fetch=OFF;
+let $s = `select unix_timestamp()`;
+let $i = 0;
+while ($i < $maxq) {
+ SELECT count(*) from t;
+ inc $i;
+}
+let $time_bf_off = `select unix_timestamp() - $s`;
+
+if ($debug) { echo index scans took $time_bf_off.; }
+
+# check that the scan time with bulk fetch off is at least 1.5 times as long as with bulk fetch on
+let $verdict = `select $time_bf_off > $time_bf_on && $time_bf_off >= 1.5 * $time_bf_on`;
+echo $verdict;
+if (!$verdict) { echo index scan $time_bf_on $time_bf_off; }
+
+set tokudb_bulk_fetch=ON;
+let $s = `select unix_timestamp()`;
+let $i = 0;
+while ($i < $maxq) {
+ SELECT count(*) from t where num > 700000;
+ inc $i;
+}
+let $time_bf_on = `select unix_timestamp() - $s`;
+
+if ($debug) { echo range scans took $time_bf_on; }
+
+set tokudb_bulk_fetch=OFF;
+let $s = `select unix_timestamp()`;
+let $i = 0;
+while ($i < $maxq) {
+ SELECT count(*) from t where num > 700000;
+ inc $i;
+}
+let $time_bf_off = `select unix_timestamp() - $s`;
+
+if ($debug) { echo range scans took $time_bf_off.; }
+
+# check that the scan time with bulk fetch off is at least 1.5 times as long as with bulk fetch on
+let $verdict = `select $time_bf_off > $time_bf_on && $time_bf_off >= 1.5 * $time_bf_on`;
+echo $verdict;
+if (!$verdict) { echo range scan $time_bf_on $time_bf_off; }
+
+drop table t;