diff --git a/mysql-test/suite/tokudb/r/bf_create_select.result b/mysql-test/suite/tokudb/r/bf_create_select.result
index adacf1ed6aa..c98bf2a4b78 100644
--- a/mysql-test/suite/tokudb/r/bf_create_select.result
+++ b/mysql-test/suite/tokudb/r/bf_create_select.result
@@ -1,72 +1,56 @@
 set default_storage_engine='tokudb';
-drop table if exists t,t1,t2;
-CREATE TABLE `t` (
+drop table if exists t1,t2;
+CREATE TABLE `t1` (
 `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;
+INSERT INTO t1 values (null,null);
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+SELECT count(*) FROM t1;
 count(*)
-8388608
-CREATE TABLE `t1` (
-`num` int(10) unsigned NOT NULL,
-`val` varchar(32) DEFAULT NULL,
-PRIMARY KEY (`num`)
-) 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
+1048576
+set tokudb_bulk_fetch=ON;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+set tokudb_bulk_fetch=OFF;
 CREATE TABLE t2 AS SELECT count(*) from t1;
 DROP TABLE t2;
 CREATE TABLE t2 AS SELECT count(*) from t1;
@@ -88,155 +72,127 @@ DROP TABLE t2;
 CREATE TABLE t2 AS SELECT count(*) from t1;
 DROP TABLE t2;
 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
-CREATE TABLE t2 AS SELECT count(*) from t1 where num > 7000000;
+set tokudb_bulk_fetch=ON;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
 DROP TABLE t2;
-CREATE TABLE t2 AS SELECT count(*) from t1 where num > 7000000;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
 DROP TABLE t2;
-CREATE TABLE t2 AS SELECT count(*) from t1 where num > 7000000;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
 DROP TABLE t2;
-CREATE TABLE t2 AS SELECT count(*) from t1 where num > 7000000;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
 DROP TABLE t2;
-CREATE TABLE t2 AS SELECT count(*) from t1 where num > 7000000;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
 DROP TABLE t2;
-CREATE TABLE t2 AS SELECT count(*) from t1 where num > 7000000;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
 DROP TABLE t2;
-CREATE TABLE t2 AS SELECT count(*) from t1 where num > 7000000;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
 DROP TABLE t2;
-CREATE TABLE t2 AS SELECT count(*) from t1 where num > 7000000;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
 DROP TABLE t2;
-CREATE TABLE t2 AS SELECT count(*) from t1 where num > 7000000;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
 DROP TABLE t2;
-CREATE TABLE t2 AS SELECT count(*) from t1 where num > 7000000;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
 DROP TABLE t2;
-CREATE TABLE t2 AS SELECT count(*) from t1 where num > 7000000;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
 DROP TABLE t2;
-CREATE TABLE t2 AS SELECT count(*) from t1 where num > 7000000;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
 DROP TABLE t2;
-CREATE TABLE t2 AS SELECT count(*) from t1 where num > 7000000;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
 DROP TABLE t2;
-CREATE TABLE t2 AS SELECT count(*) from t1 where num > 7000000;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
 DROP TABLE t2;
-CREATE TABLE t2 AS SELECT count(*) from t1 where num > 7000000;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
 DROP TABLE t2;
-CREATE TABLE t2 AS SELECT count(*) from t1 where num > 7000000;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
 DROP TABLE t2;
-CREATE TABLE t2 AS SELECT count(*) from t1 where num > 7000000;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
 DROP TABLE t2;
-CREATE TABLE t2 AS SELECT count(*) from t1 where num > 7000000;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
 DROP TABLE t2;
-CREATE TABLE t2 AS SELECT count(*) from t1 where num > 7000000;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
 DROP TABLE t2;
-CREATE TABLE t2 AS SELECT count(*) from t1 where num > 7000000;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
 DROP TABLE t2;
-CREATE TABLE t2 AS SELECT count(*) from t1 where num > 7000000;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
 DROP TABLE t2;
-CREATE TABLE t2 AS SELECT count(*) from t1 where num > 7000000;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
 DROP TABLE t2;
-CREATE TABLE t2 AS SELECT count(*) from t1 where num > 7000000;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
 DROP TABLE t2;
-CREATE TABLE t2 AS SELECT count(*) from t1 where num > 7000000;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
 DROP TABLE t2;
-CREATE TABLE t2 AS SELECT count(*) from t1 where num > 7000000;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
 DROP TABLE t2;
-CREATE TABLE t2 AS SELECT count(*) from t1 where num > 7000000;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
 DROP TABLE t2;
-CREATE TABLE t2 AS SELECT count(*) from t1 where num > 7000000;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
 DROP TABLE t2;
-CREATE TABLE t2 AS SELECT count(*) from t1 where num > 7000000;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
 DROP TABLE t2;
-CREATE TABLE t2 AS SELECT count(*) from t1 where num > 7000000;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
 DROP TABLE t2;
-CREATE TABLE t2 AS SELECT count(*) from t1 where num > 7000000;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+set tokudb_bulk_fetch=OFF;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
 DROP TABLE t2;
 1
-drop table t,t1;
+drop table t1;
diff --git a/mysql-test/suite/tokudb/r/bf_create_select_hash_part.result b/mysql-test/suite/tokudb/r/bf_create_select_hash_part.result
index f8c8e6c596d..c352980124c 100644
--- a/mysql-test/suite/tokudb/r/bf_create_select_hash_part.result
+++ b/mysql-test/suite/tokudb/r/bf_create_select_hash_part.result
@@ -1,328 +1,198 @@
 set default_storage_engine='tokudb';
-drop table if exists t,t1,t2,t3;
-CREATE TABLE `t` (
+drop table if exists t1,t2;
+CREATE TABLE `t1` (
 `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;
+) PARTITION BY HASH (num) PARTITIONS 8;
+INSERT INTO t1 values (null,null);
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+SELECT count(*) FROM t1;
 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` (`x` bigint);
-SELECT count(*) from t1;
-count(*)
-8388608
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1;
-count(*)
-8388608
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1;
-count(*)
-8388608
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1;
-count(*)
-8388608
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1;
-count(*)
-8388608
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1;
-count(*)
-8388608
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1;
-count(*)
-8388608
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1;
-count(*)
-8388608
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1;
-count(*)
-8388608
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1;
-count(*)
-8388608
-DROP TABLE t3;
-CREATE TABLE t3 AS SELECT count(*) from t2;
-DROP TABLE t3;
-CREATE TABLE t3 AS SELECT count(*) from t2;
-DROP TABLE t3;
-CREATE TABLE t3 AS SELECT count(*) from t2;
-DROP TABLE t3;
-CREATE TABLE t3 AS SELECT count(*) from t2;
-DROP TABLE t3;
-CREATE TABLE t3 AS SELECT count(*) from t2;
-DROP TABLE t3;
-CREATE TABLE t3 AS SELECT count(*) from t2;
-DROP TABLE t3;
-CREATE TABLE t3 AS SELECT count(*) from t2;
-DROP TABLE t3;
-CREATE TABLE t3 AS SELECT count(*) from t2;
-DROP TABLE t3;
-CREATE TABLE t3 AS SELECT count(*) from t2;
-DROP TABLE t3;
-CREATE TABLE t3 AS SELECT count(*) from t2;
-DROP TABLE t3;
+1048576
+set tokudb_bulk_fetch=ON;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+set tokudb_bulk_fetch=OFF;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
 1
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-DROP TABLE t3;
-CREATE TABLE t3 AS SELECT count(*) from t2 where num > 7000000;
-DROP TABLE t3;
-CREATE TABLE t3 AS SELECT count(*) from t2 where num > 7000000;
-DROP TABLE t3;
-CREATE TABLE t3 AS SELECT count(*) from t2 where num > 7000000;
-DROP TABLE t3;
-CREATE TABLE t3 AS SELECT count(*) from t2 where num > 7000000;
-DROP TABLE t3;
-CREATE TABLE t3 AS SELECT count(*) from t2 where num > 7000000;
-DROP TABLE t3;
-CREATE TABLE t3 AS SELECT count(*) from t2 where num > 7000000;
-DROP TABLE t3;
-CREATE TABLE t3 AS SELECT count(*) from t2 where num > 7000000;
-DROP TABLE t3;
-CREATE TABLE t3 AS SELECT count(*) from t2 where num > 7000000;
-DROP TABLE t3;
-CREATE TABLE t3 AS SELECT count(*) from t2 where num > 7000000;
-DROP TABLE t3;
-CREATE TABLE t3 AS SELECT count(*) from t2 where num > 7000000;
-DROP TABLE t3;
-CREATE TABLE t3 AS SELECT count(*) from t2 where num > 7000000;
-DROP TABLE t3;
-CREATE TABLE t3 AS SELECT count(*) from t2 where num > 7000000;
-DROP TABLE t3;
-CREATE TABLE t3 AS SELECT count(*) from t2 where num > 7000000;
-DROP TABLE t3;
-CREATE TABLE t3 AS SELECT count(*) from t2 where num > 7000000;
-DROP TABLE t3;
-CREATE TABLE t3 AS SELECT count(*) from t2 where num > 7000000;
-DROP TABLE t3;
-CREATE TABLE t3 AS SELECT count(*) from t2 where num > 7000000;
-DROP TABLE t3;
-CREATE TABLE t3 AS SELECT count(*) from t2 where num > 7000000;
-DROP TABLE t3;
-CREATE TABLE t3 AS SELECT count(*) from t2 where num > 7000000;
-DROP TABLE t3;
-CREATE TABLE t3 AS SELECT count(*) from t2 where num > 7000000;
-DROP TABLE t3;
-CREATE TABLE t3 AS SELECT count(*) from t2 where num > 7000000;
-DROP TABLE t3;
-CREATE TABLE t3 AS SELECT count(*) from t2 where num > 7000000;
-DROP TABLE t3;
-CREATE TABLE t3 AS SELECT count(*) from t2 where num > 7000000;
-DROP TABLE t3;
-CREATE TABLE t3 AS SELECT count(*) from t2 where num > 7000000;
-DROP TABLE t3;
-CREATE TABLE t3 AS SELECT count(*) from t2 where num > 7000000;
-DROP TABLE t3;
-CREATE TABLE t3 AS SELECT count(*) from t2 where num > 7000000;
-DROP TABLE t3;
-CREATE TABLE t3 AS SELECT count(*) from t2 where num > 7000000;
-DROP TABLE t3;
-CREATE TABLE t3 AS SELECT count(*) from t2 where num > 7000000;
-DROP TABLE t3;
-CREATE TABLE t3 AS SELECT count(*) from t2 where num > 7000000;
-DROP TABLE t3;
-CREATE TABLE t3 AS SELECT count(*) from t2 where num > 7000000;
-DROP TABLE t3;
-CREATE TABLE t3 AS SELECT count(*) from t2 where num > 7000000;
-DROP TABLE t3;
+set tokudb_bulk_fetch=ON;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+set tokudb_bulk_fetch=OFF;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
 1
-drop table t,t1,t2;
+drop table t1;
diff --git a/mysql-test/suite/tokudb/r/bf_create_select_range_part.result b/mysql-test/suite/tokudb/r/bf_create_select_range_part.result
index 0e055e76d3f..47e3ee7718a 100644
--- a/mysql-test/suite/tokudb/r/bf_create_select_range_part.result
+++ b/mysql-test/suite/tokudb/r/bf_create_select_range_part.result
@@ -1,335 +1,206 @@
 set default_storage_engine='tokudb';
-drop table if exists t,t1,t2;
-CREATE TABLE `t` (
+drop table if exists t1,t2;
+CREATE TABLE `t1` (
 `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 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;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1;
+(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 t1 values (null,null);
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+SELECT count(*) FROM t1;
 count(*)
-8388608
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1;
-count(*)
-8388608
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1;
-count(*)
-8388608
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1;
-count(*)
-8388608
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1;
-count(*)
-8388608
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1;
-count(*)
-8388608
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1;
-count(*)
-8388608
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1;
-count(*)
-8388608
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1;
-count(*)
-8388608
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1;
-count(*)
-8388608
-DROP TABLE t3;
-CREATE TABLE t4 AS SELECT count(*) from t2;
-DROP TABLE t4;
-CREATE TABLE t4 AS SELECT count(*) from t2;
-DROP TABLE t4;
-CREATE TABLE t4 AS SELECT count(*) from t2;
-DROP TABLE t4;
-CREATE TABLE t4 AS SELECT count(*) from t2;
-DROP TABLE t4;
-CREATE TABLE t4 AS SELECT count(*) from t2;
-DROP TABLE t4;
-CREATE TABLE t4 AS SELECT count(*) from t2;
-DROP TABLE t4;
-CREATE TABLE t4 AS SELECT count(*) from t2;
-DROP TABLE t4;
-CREATE TABLE t4 AS SELECT count(*) from t2;
-DROP TABLE t4;
-CREATE TABLE t4 AS SELECT count(*) from t2;
-DROP TABLE t4;
-CREATE TABLE t4 AS SELECT count(*) from t2;
-DROP TABLE t4;
+1048576
+set tokudb_bulk_fetch=ON;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+set tokudb_bulk_fetch=OFF;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
 1
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-DROP TABLE t3;
-CREATE TABLE `t3` (`x` bigint);
-SELECT count(*) from t1 where num > 7000000;
-count(*)
-1847274
-DROP TABLE t3;
-CREATE TABLE t4 AS SELECT count(*) from t2 where num > 7000000;
-DROP TABLE t4;
-CREATE TABLE t4 AS SELECT count(*) from t2 where num > 7000000;
-DROP TABLE t4;
-CREATE TABLE t4 AS SELECT count(*) from t2 where num > 7000000;
-DROP TABLE t4;
-CREATE TABLE t4 AS SELECT count(*) from t2 where num > 7000000;
-DROP TABLE t4;
-CREATE TABLE t4 AS SELECT count(*) from t2 where num > 7000000;
-DROP TABLE t4;
-CREATE TABLE t4 AS SELECT count(*) from t2 where num > 7000000;
-DROP TABLE t4;
-CREATE TABLE t4 AS SELECT count(*) from t2 where num > 7000000;
-DROP TABLE t4;
-CREATE TABLE t4 AS SELECT count(*) from t2 where num > 7000000;
-DROP TABLE t4;
-CREATE TABLE t4 AS SELECT count(*) from t2 where num > 7000000;
-DROP TABLE t4;
-CREATE TABLE t4 AS SELECT count(*) from t2 where num > 7000000;
-DROP TABLE t4;
-CREATE TABLE t4 AS SELECT count(*) from t2 where num > 7000000;
-DROP TABLE t4;
-CREATE TABLE t4 AS SELECT count(*) from t2 where num > 7000000;
-DROP TABLE t4;
-CREATE TABLE t4 AS SELECT count(*) from t2 where num > 7000000;
-DROP TABLE t4;
-CREATE TABLE t4 AS SELECT count(*) from t2 where num > 7000000;
-DROP TABLE t4;
-CREATE TABLE t4 AS SELECT count(*) from t2 where num > 7000000;
-DROP TABLE t4;
-CREATE TABLE t4 AS SELECT count(*) from t2 where num > 7000000;
-DROP TABLE t4;
-CREATE TABLE t4 AS SELECT count(*) from t2 where num > 7000000;
-DROP TABLE t4;
-CREATE TABLE t4 AS SELECT count(*) from t2 where num > 7000000;
-DROP TABLE t4;
-CREATE TABLE t4 AS SELECT count(*) from t2 where num > 7000000;
-DROP TABLE t4;
-CREATE TABLE t4 AS SELECT count(*) from t2 where num > 7000000;
-DROP TABLE t4;
-CREATE TABLE t4 AS SELECT count(*) from t2 where num > 7000000;
-DROP TABLE t4;
-CREATE TABLE t4 AS SELECT count(*) from t2 where num > 7000000;
-DROP TABLE t4;
-CREATE TABLE t4 AS SELECT count(*) from t2 where num > 7000000;
-DROP TABLE t4;
-CREATE TABLE t4 AS SELECT count(*) from t2 where num > 7000000;
-DROP TABLE t4;
-CREATE TABLE t4 AS SELECT count(*) from t2 where num > 7000000;
-DROP TABLE t4;
-CREATE TABLE t4 AS SELECT count(*) from t2 where num > 7000000;
-DROP TABLE t4;
-CREATE TABLE t4 AS SELECT count(*) from t2 where num > 7000000;
-DROP TABLE t4;
-CREATE TABLE t4 AS SELECT count(*) from t2 where num > 7000000;
-DROP TABLE t4;
-CREATE TABLE t4 AS SELECT count(*) from t2 where num > 7000000;
-DROP TABLE t4;
-CREATE TABLE t4 AS SELECT count(*) from t2 where num > 7000000;
-DROP TABLE t4;
+set tokudb_bulk_fetch=ON;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+set tokudb_bulk_fetch=OFF;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
 1
-drop table t,t1,t2;
+drop table t1;
diff --git a/mysql-test/suite/tokudb/r/bf_create_temp_select.result b/mysql-test/suite/tokudb/r/bf_create_temp_select.result
index 6eddfaa9e82..543bd795e2e 100644
--- a/mysql-test/suite/tokudb/r/bf_create_temp_select.result
+++ b/mysql-test/suite/tokudb/r/bf_create_temp_select.result
@@ -1,242 +1,198 @@
 set default_storage_engine='tokudb';
-drop table if exists t,t1,t2;
-CREATE TABLE `t` (
+drop table if exists t1,t2;
+CREATE TABLE `t1` (
 `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;
+INSERT INTO t1 values (null,null);
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+SELECT count(*) FROM t1;
 count(*)
-8388608
-CREATE TABLE `t1` (
-`num` int(10) unsigned NOT NULL,
-`val` varchar(32) DEFAULT NULL,
-PRIMARY KEY (`num`)
-) 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
+1048576
+set tokudb_bulk_fetch=ON;
 CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1;
-DROP TEMPORARY TABLE t2;
+DROP TABLE t2;
 CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1;
-DROP TEMPORARY TABLE t2;
+DROP TABLE t2;
 CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1;
-DROP TEMPORARY TABLE t2;
+DROP TABLE t2;
 CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1;
-DROP TEMPORARY TABLE t2;
+DROP TABLE t2;
 CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1;
-DROP TEMPORARY TABLE t2;
+DROP TABLE t2;
 CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1;
-DROP TEMPORARY TABLE t2;
+DROP TABLE t2;
 CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1;
-DROP TEMPORARY TABLE t2;
+DROP TABLE t2;
 CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1;
-DROP TEMPORARY TABLE t2;
+DROP TABLE t2;
 CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1;
-DROP TEMPORARY TABLE t2;
+DROP TABLE t2;
 CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1;
-DROP TEMPORARY TABLE t2;
+DROP TABLE t2;
+set tokudb_bulk_fetch=OFF;
+CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
+CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1;
+DROP TABLE t2;
 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
-CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 7000000;
-DROP TEMPORARY TABLE t2;
-CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 7000000;
-DROP TEMPORARY TABLE t2;
-CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 7000000;
-DROP TEMPORARY TABLE t2;
-CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 7000000;
-DROP TEMPORARY TABLE t2;
-CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 7000000;
-DROP TEMPORARY TABLE t2;
-CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 7000000;
-DROP TEMPORARY TABLE t2;
-CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 7000000;
-DROP TEMPORARY TABLE t2;
-CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 7000000;
-DROP TEMPORARY TABLE t2;
-CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 7000000;
-DROP TEMPORARY TABLE t2;
-CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 7000000;
-DROP TEMPORARY TABLE t2;
-CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 7000000;
-DROP TEMPORARY TABLE t2;
-CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 7000000;
-DROP TEMPORARY TABLE t2;
-CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 7000000;
-DROP TEMPORARY TABLE t2;
-CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 7000000;
-DROP TEMPORARY TABLE t2;
-CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 7000000;
-DROP TEMPORARY TABLE t2;
-CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 7000000;
-DROP TEMPORARY TABLE t2;
-CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 7000000;
-DROP TEMPORARY TABLE t2;
-CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 7000000;
-DROP TEMPORARY TABLE t2;
-CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 7000000;
-DROP TEMPORARY TABLE t2;
-CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 7000000;
-DROP TEMPORARY TABLE t2;
-CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 7000000;
-DROP TEMPORARY TABLE t2;
-CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 7000000;
-DROP TEMPORARY TABLE t2;
-CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 7000000;
-DROP TEMPORARY TABLE t2;
-CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 7000000;
-DROP TEMPORARY TABLE t2;
-CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 7000000;
-DROP TEMPORARY TABLE t2;
-CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 7000000;
-DROP TEMPORARY TABLE t2;
-CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 7000000;
-DROP TEMPORARY TABLE t2;
-CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 7000000;
-DROP TEMPORARY TABLE t2;
-CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 7000000;
-DROP TEMPORARY TABLE t2;
-CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 7000000;
-DROP TEMPORARY TABLE t2;
+set tokudb_bulk_fetch=ON;
+CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+set tokudb_bulk_fetch=OFF;
+CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
+CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+DROP TABLE t2;
 1
-drop table t,t1;
+drop table t1;
diff --git a/mysql-test/suite/tokudb/r/bf_insert_select.result b/mysql-test/suite/tokudb/r/bf_insert_select.result
index ba7d0f63cd6..403e5ec5938 100644
--- a/mysql-test/suite/tokudb/r/bf_insert_select.result
+++ b/mysql-test/suite/tokudb/r/bf_insert_select.result
@@ -1,75 +1,69 @@
 set default_storage_engine='tokudb';
-drop table if exists t,t1,t2;
-CREATE TABLE `t` (
+drop table if exists t1,t2;
+CREATE TABLE `t1` (
 `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` (
 `count` bigint(20) NOT NULL
-) ENGINE=TokuDB DEFAULT CHARSET=latin1;
-SELECT count(*) from t1;
+);
+INSERT INTO t1 values (null,null);
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+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
+1048576
+set tokudb_bulk_fetch=ON;
+INSERT into t2 SELECT count(*) from t1;
+INSERT into t2 SELECT count(*) from t1;
+INSERT into t2 SELECT count(*) from t1;
+INSERT into t2 SELECT count(*) from t1;
+INSERT into t2 SELECT count(*) from t1;
+INSERT into t2 SELECT count(*) from t1;
+INSERT into t2 SELECT count(*) from t1;
+INSERT into t2 SELECT count(*) from t1;
+INSERT into t2 SELECT count(*) from t1;
+INSERT into t2 SELECT count(*) from t1;
+INSERT into t2 SELECT count(*) from t1;
+INSERT into t2 SELECT count(*) from t1;
+INSERT into t2 SELECT count(*) from t1;
+INSERT into t2 SELECT count(*) from t1;
+INSERT into t2 SELECT count(*) from t1;
+INSERT into t2 SELECT count(*) from t1;
+INSERT into t2 SELECT count(*) from t1;
+INSERT into t2 SELECT count(*) from t1;
+INSERT into t2 SELECT count(*) from t1;
+INSERT into t2 SELECT count(*) from t1;
+set tokudb_bulk_fetch=OFF;
+INSERT into t2 SELECT count(*) from t1;
+INSERT into t2 SELECT count(*) from t1;
+INSERT into t2 SELECT count(*) from t1;
+INSERT into t2 SELECT count(*) from t1;
+INSERT into t2 SELECT count(*) from t1;
+INSERT into t2 SELECT count(*) from t1;
+INSERT into t2 SELECT count(*) from t1;
+INSERT into t2 SELECT count(*) from t1;
+INSERT into t2 SELECT count(*) from t1;
+INSERT into t2 SELECT count(*) from t1;
 INSERT into t2 SELECT count(*) from t1;
 INSERT into t2 SELECT count(*) from t1;
 INSERT into t2 SELECT count(*) from t1;
@@ -81,125 +75,47 @@ INSERT into t2 SELECT count(*) from t1;
 INSERT into t2 SELECT count(*) from t1;
 INSERT into t2 SELECT count(*) from t1;
 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
-INSERT into t2 SELECT count(*) from t1 where num > 7000000;
-INSERT into t2 SELECT count(*) from t1 where num > 7000000;
-INSERT into t2 SELECT count(*) from t1 where num > 7000000;
-INSERT into t2 SELECT count(*) from t1 where num > 7000000;
-INSERT into t2 SELECT count(*) from t1 where num > 7000000;
-INSERT into t2 SELECT count(*) from t1 where num > 7000000;
-INSERT into t2 SELECT count(*) from t1 where num > 7000000;
-INSERT into t2 SELECT count(*) from t1 where num > 7000000;
-INSERT into t2 SELECT count(*) from t1 where num > 7000000;
-INSERT into t2 SELECT count(*) from t1 where num > 7000000;
-INSERT into t2 SELECT count(*) from t1 where num > 7000000;
-INSERT into t2 SELECT count(*) from t1 where num > 7000000;
-INSERT into t2 SELECT count(*) from t1 where num > 7000000;
-INSERT into t2 SELECT count(*) from t1 where num > 7000000;
-INSERT into t2 SELECT count(*) from t1 where num > 7000000;
-INSERT into t2 SELECT count(*) from t1 where num > 7000000;
-INSERT into t2 SELECT count(*) from t1 where num > 7000000;
-INSERT into t2 SELECT count(*) from t1 where num > 7000000;
-INSERT into t2 SELECT count(*) from t1 where num > 7000000;
-INSERT into t2 SELECT count(*) from t1 where num > 7000000;
-INSERT into t2 SELECT count(*) from t1 where num > 7000000;
-INSERT into t2 SELECT count(*) from t1 where num > 7000000;
-INSERT into t2 SELECT count(*) from t1 where num > 7000000;
-INSERT into t2 SELECT count(*) from t1 where num > 7000000;
-INSERT into t2 SELECT count(*) from t1 where num > 7000000;
-INSERT into t2 SELECT count(*) from t1 where num > 7000000;
-INSERT into t2 SELECT count(*) from t1 where num > 7000000;
-INSERT into t2 SELECT count(*) from t1 where num > 7000000;
-INSERT into t2 SELECT count(*) from t1 where num > 7000000;
-INSERT into t2 SELECT count(*) from t1 where num > 7000000;
+set tokudb_bulk_fetch=ON;
+INSERT into t2 SELECT count(*) from t1 where num > 700000;
+INSERT into t2 SELECT count(*) from t1 where num > 700000;
+INSERT into t2 SELECT count(*) from t1 where num > 700000;
+INSERT into t2 SELECT count(*) from t1 where num > 700000;
+INSERT into t2 SELECT count(*) from t1 where num > 700000;
+INSERT into t2 SELECT count(*) from t1 where num > 700000;
+INSERT into t2 SELECT count(*) from t1 where num > 700000;
+INSERT into t2 SELECT count(*) from t1 where num > 700000;
+INSERT into t2 SELECT count(*) from t1 where num > 700000;
+INSERT into t2 SELECT count(*) from t1 where num > 700000;
+INSERT into t2 SELECT count(*) from t1 where num > 700000;
+INSERT into t2 SELECT count(*) from t1 where num > 700000;
+INSERT into t2 SELECT count(*) from t1 where num > 700000;
+INSERT into t2 SELECT count(*) from t1 where num > 700000;
+INSERT into t2 SELECT count(*) from t1 where num > 700000;
+INSERT into t2 SELECT count(*) from t1 where num > 700000;
+INSERT into t2 SELECT count(*) from t1 where num > 700000;
+INSERT into t2 SELECT count(*) from t1 where num > 700000;
+INSERT into t2 SELECT count(*) from t1 where num > 700000;
+INSERT into t2 SELECT count(*) from t1 where num > 700000;
+set tokudb_bulk_fetch=OFF;
+INSERT into t2 SELECT count(*) from t1 where num > 700000;
+INSERT into t2 SELECT count(*) from t1 where num > 700000;
+INSERT into t2 SELECT count(*) from t1 where num > 700000;
+INSERT into t2 SELECT count(*) from t1 where num > 700000;
+INSERT into t2 SELECT count(*) from t1 where num > 700000;
+INSERT into t2 SELECT count(*) from t1 where num > 700000;
+INSERT into t2 SELECT count(*) from t1 where num > 700000;
+INSERT into t2 SELECT count(*) from t1 where num > 700000;
+INSERT into t2 SELECT count(*) from t1 where num > 700000;
+INSERT into t2 SELECT count(*) from t1 where num > 700000;
+INSERT into t2 SELECT count(*) from t1 where num > 700000;
+INSERT into t2 SELECT count(*) from t1 where num > 700000;
+INSERT into t2 SELECT count(*) from t1 where num > 700000;
+INSERT into t2 SELECT count(*) from t1 where num > 700000;
+INSERT into t2 SELECT count(*) from t1 where num > 700000;
+INSERT into t2 SELECT count(*) from t1 where num > 700000;
+INSERT into t2 SELECT count(*) from t1 where num > 700000;
+INSERT into t2 SELECT count(*) from t1 where num > 700000;
+INSERT into t2 SELECT count(*) from t1 where num > 700000;
+INSERT into t2 SELECT count(*) from t1 where num > 700000;
 1
-drop table t,t1,t2;
+drop table t1,t2;
diff --git a/mysql-test/suite/tokudb/r/bf_insert_select_dup_key.result b/mysql-test/suite/tokudb/r/bf_insert_select_dup_key.result
index 22e2846d181..a725c4d8aca 100644
--- a/mysql-test/suite/tokudb/r/bf_insert_select_dup_key.result
+++ b/mysql-test/suite/tokudb/r/bf_insert_select_dup_key.result
@@ -1,77 +1,71 @@
 set default_storage_engine='tokudb';
-drop table if exists t,t1,t2;
-CREATE TABLE `t` (
+drop table if exists t1,t2;
+CREATE TABLE `t1` (
 `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;
+INSERT INTO t1 values (null,null);
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+SELECT count(*) FROM t1;
 count(*)
-8388608
-CREATE TABLE `t1` (
-`num` int(10) unsigned NOT NULL,
-`val` varchar(32) DEFAULT NULL,
-PRIMARY KEY (`num`)
-) as select * from t;
+1048576
 CREATE TABLE `t2` (
 `num` int(10) unsigned auto_increment NOT NULL, 
 `count` bigint(20) NOT NULL,
 UNIQUE (num)
-) ENGINE=TokuDB DEFAULT CHARSET=latin1;
-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
+);
+set tokudb_bulk_fetch=ON;
+INSERT into t2 (num,count) SELECT NULL,count(*) from t1 on DUPLICATE KEY UPDATE count=count+1;
+INSERT into t2 (num,count) SELECT NULL,count(*) from t1 on DUPLICATE KEY UPDATE count=count+1;
+INSERT into t2 (num,count) SELECT NULL,count(*) from t1 on DUPLICATE KEY UPDATE count=count+1;
+INSERT into t2 (num,count) SELECT NULL,count(*) from t1 on DUPLICATE KEY UPDATE count=count+1;
+INSERT into t2 (num,count) SELECT NULL,count(*) from t1 on DUPLICATE KEY UPDATE count=count+1;
+INSERT into t2 (num,count) SELECT NULL,count(*) from t1 on DUPLICATE KEY UPDATE count=count+1;
+INSERT into t2 (num,count) SELECT NULL,count(*) from t1 on DUPLICATE KEY UPDATE count=count+1;
+INSERT into t2 (num,count) SELECT NULL,count(*) from t1 on DUPLICATE KEY UPDATE count=count+1;
+INSERT into t2 (num,count) SELECT NULL,count(*) from t1 on DUPLICATE KEY UPDATE count=count+1;
+INSERT into t2 (num,count) SELECT NULL,count(*) from t1 on DUPLICATE KEY UPDATE count=count+1;
+INSERT into t2 (num,count) SELECT NULL,count(*) from t1 on DUPLICATE KEY UPDATE count=count+1;
+INSERT into t2 (num,count) SELECT NULL,count(*) from t1 on DUPLICATE KEY UPDATE count=count+1;
+INSERT into t2 (num,count) SELECT NULL,count(*) from t1 on DUPLICATE KEY UPDATE count=count+1;
+INSERT into t2 (num,count) SELECT NULL,count(*) from t1 on DUPLICATE KEY UPDATE count=count+1;
+INSERT into t2 (num,count) SELECT NULL,count(*) from t1 on DUPLICATE KEY UPDATE count=count+1;
+INSERT into t2 (num,count) SELECT NULL,count(*) from t1 on DUPLICATE KEY UPDATE count=count+1;
+INSERT into t2 (num,count) SELECT NULL,count(*) from t1 on DUPLICATE KEY UPDATE count=count+1;
+INSERT into t2 (num,count) SELECT NULL,count(*) from t1 on DUPLICATE KEY UPDATE count=count+1;
+INSERT into t2 (num,count) SELECT NULL,count(*) from t1 on DUPLICATE KEY UPDATE count=count+1;
+INSERT into t2 (num,count) SELECT NULL,count(*) from t1 on DUPLICATE KEY UPDATE count=count+1;
+set tokudb_bulk_fetch=OFF;
+INSERT into t2 (num,count) SELECT NULL,count(*) from t1 on DUPLICATE KEY UPDATE count=count+1;
+INSERT into t2 (num,count) SELECT NULL,count(*) from t1 on DUPLICATE KEY UPDATE count=count+1;
+INSERT into t2 (num,count) SELECT NULL,count(*) from t1 on DUPLICATE KEY UPDATE count=count+1;
+INSERT into t2 (num,count) SELECT NULL,count(*) from t1 on DUPLICATE KEY UPDATE count=count+1;
+INSERT into t2 (num,count) SELECT NULL,count(*) from t1 on DUPLICATE KEY UPDATE count=count+1;
+INSERT into t2 (num,count) SELECT NULL,count(*) from t1 on DUPLICATE KEY UPDATE count=count+1;
+INSERT into t2 (num,count) SELECT NULL,count(*) from t1 on DUPLICATE KEY UPDATE count=count+1;
+INSERT into t2 (num,count) SELECT NULL,count(*) from t1 on DUPLICATE KEY UPDATE count=count+1;
+INSERT into t2 (num,count) SELECT NULL,count(*) from t1 on DUPLICATE KEY UPDATE count=count+1;
+INSERT into t2 (num,count) SELECT NULL,count(*) from t1 on DUPLICATE KEY UPDATE count=count+1;
 INSERT into t2 (num,count) SELECT NULL,count(*) from t1 on DUPLICATE KEY UPDATE count=count+1;
 INSERT into t2 (num,count) SELECT NULL,count(*) from t1 on DUPLICATE KEY UPDATE count=count+1;
 INSERT into t2 (num,count) SELECT NULL,count(*) from t1 on DUPLICATE KEY UPDATE count=count+1;
@@ -83,125 +77,47 @@ INSERT into t2 (num,count) SELECT NULL,count(*) from t1 on DUPLICATE KEY UPDATE
 INSERT into t2 (num,count) SELECT NULL,count(*) from t1 on DUPLICATE KEY UPDATE count=count+1;
 INSERT into t2 (num,count) SELECT NULL,count(*) from t1 on DUPLICATE KEY UPDATE count=count+1;
 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
-INSERT into t2 (num,count) SELECT NULL,count(*) from t1 where num > 7000000 on DUPLICATE KEY UPDATE count=count+1;
-INSERT into t2 (num,count) SELECT NULL,count(*) from t1 where num > 7000000 on DUPLICATE KEY UPDATE count=count+1;
-INSERT into t2 (num,count) SELECT NULL,count(*) from t1 where num > 7000000 on DUPLICATE KEY UPDATE count=count+1;
-INSERT into t2 (num,count) SELECT NULL,count(*) from t1 where num > 7000000 on DUPLICATE KEY UPDATE count=count+1;
-INSERT into t2 (num,count) SELECT NULL,count(*) from t1 where num > 7000000 on DUPLICATE KEY UPDATE count=count+1;
-INSERT into t2 (num,count) SELECT NULL,count(*) from t1 where num > 7000000 on DUPLICATE KEY UPDATE count=count+1;
-INSERT into t2 (num,count) SELECT NULL,count(*) from t1 where num > 7000000 on DUPLICATE KEY UPDATE count=count+1;
-INSERT into t2 (num,count) SELECT NULL,count(*) from t1 where num > 7000000 on DUPLICATE KEY UPDATE count=count+1;
-INSERT into t2 (num,count) SELECT NULL,count(*) from t1 where num > 7000000 on DUPLICATE KEY UPDATE count=count+1;
-INSERT into t2 (num,count) SELECT NULL,count(*) from t1 where num > 7000000 on DUPLICATE KEY UPDATE count=count+1;
-INSERT into t2 (num,count) SELECT NULL,count(*) from t1 where num > 7000000 on DUPLICATE KEY UPDATE count=count+1;
-INSERT into t2 (num,count) SELECT NULL,count(*) from t1 where num > 7000000 on DUPLICATE KEY UPDATE count=count+1;
-INSERT into t2 (num,count) SELECT NULL,count(*) from t1 where num > 7000000 on DUPLICATE KEY UPDATE count=count+1;
-INSERT into t2 (num,count) SELECT NULL,count(*) from t1 where num > 7000000 on DUPLICATE KEY UPDATE count=count+1;
-INSERT into t2 (num,count) SELECT NULL,count(*) from t1 where num > 7000000 on DUPLICATE KEY UPDATE count=count+1;
-INSERT into t2 (num,count) SELECT NULL,count(*) from t1 where num > 7000000 on DUPLICATE KEY UPDATE count=count+1;
-INSERT into t2 (num,count) SELECT NULL,count(*) from t1 where num > 7000000 on DUPLICATE KEY UPDATE count=count+1;
-INSERT into t2 (num,count) SELECT NULL,count(*) from t1 where num > 7000000 on DUPLICATE KEY UPDATE count=count+1;
-INSERT into t2 (num,count) SELECT NULL,count(*) from t1 where num > 7000000 on DUPLICATE KEY UPDATE count=count+1;
-INSERT into t2 (num,count) SELECT NULL,count(*) from t1 where num > 7000000 on DUPLICATE KEY UPDATE count=count+1;
-INSERT into t2 (num,count) SELECT NULL,count(*) from t1 where num > 7000000 on DUPLICATE KEY UPDATE count=count+1;
-INSERT into t2 (num,count) SELECT NULL,count(*) from t1 where num > 7000000 on DUPLICATE KEY UPDATE count=count+1;
-INSERT into t2 (num,count) SELECT NULL,count(*) from t1 where num > 7000000 on DUPLICATE KEY UPDATE count=count+1;
-INSERT into t2 (num,count) SELECT NULL,count(*) from t1 where num > 7000000 on DUPLICATE KEY UPDATE count=count+1;
-INSERT into t2 (num,count) SELECT NULL,count(*) from t1 where num > 7000000 on DUPLICATE KEY UPDATE count=count+1;
-INSERT into t2 (num,count) SELECT NULL,count(*) from t1 where num > 7000000 on DUPLICATE KEY UPDATE count=count+1;
-INSERT into t2 (num,count) SELECT NULL,count(*) from t1 where num > 7000000 on DUPLICATE KEY UPDATE count=count+1;
-INSERT into t2 (num,count) SELECT NULL,count(*) from t1 where num > 7000000 on DUPLICATE KEY UPDATE count=count+1;
-INSERT into t2 (num,count) SELECT NULL,count(*) from t1 where num > 7000000 on DUPLICATE KEY UPDATE count=count+1;
-INSERT into t2 (num,count) SELECT NULL,count(*) from t1 where num > 7000000 on DUPLICATE KEY UPDATE count=count+1;
+set tokudb_bulk_fetch=ON;
+INSERT into t2 (num,count) SELECT NULL,count(*) from t1 where num > 700000 on DUPLICATE KEY UPDATE count=count+1;
+INSERT into t2 (num,count) SELECT NULL,count(*) from t1 where num > 700000 on DUPLICATE KEY UPDATE count=count+1;
+INSERT into t2 (num,count) SELECT NULL,count(*) from t1 where num > 700000 on DUPLICATE KEY UPDATE count=count+1;
+INSERT into t2 (num,count) SELECT NULL,count(*) from t1 where num > 700000 on DUPLICATE KEY UPDATE count=count+1;
+INSERT into t2 (num,count) SELECT NULL,count(*) from t1 where num > 700000 on DUPLICATE KEY UPDATE count=count+1;
+INSERT into t2 (num,count) SELECT NULL,count(*) from t1 where num > 700000 on DUPLICATE KEY UPDATE count=count+1;
+INSERT into t2 (num,count) SELECT NULL,count(*) from t1 where num > 700000 on DUPLICATE KEY UPDATE count=count+1;
+INSERT into t2 (num,count) SELECT NULL,count(*) from t1 where num > 700000 on DUPLICATE KEY UPDATE count=count+1;
+INSERT into t2 (num,count) SELECT NULL,count(*) from t1 where num > 700000 on DUPLICATE KEY UPDATE count=count+1;
+INSERT into t2 (num,count) SELECT NULL,count(*) from t1 where num > 700000 on DUPLICATE KEY UPDATE count=count+1;
+INSERT into t2 (num,count) SELECT NULL,count(*) from t1 where num > 700000 on DUPLICATE KEY UPDATE count=count+1;
+INSERT into t2 (num,count) SELECT NULL,count(*) from t1 where num > 700000 on DUPLICATE KEY UPDATE count=count+1;
+INSERT into t2 (num,count) SELECT NULL,count(*) from t1 where num > 700000 on DUPLICATE KEY UPDATE count=count+1;
+INSERT into t2 (num,count) SELECT NULL,count(*) from t1 where num > 700000 on DUPLICATE KEY UPDATE count=count+1;
+INSERT into t2 (num,count) SELECT NULL,count(*) from t1 where num > 700000 on DUPLICATE KEY UPDATE count=count+1;
+INSERT into t2 (num,count) SELECT NULL,count(*) from t1 where num > 700000 on DUPLICATE KEY UPDATE count=count+1;
+INSERT into t2 (num,count) SELECT NULL,count(*) from t1 where num > 700000 on DUPLICATE KEY UPDATE count=count+1;
+INSERT into t2 (num,count) SELECT NULL,count(*) from t1 where num > 700000 on DUPLICATE KEY UPDATE count=count+1;
+INSERT into t2 (num,count) SELECT NULL,count(*) from t1 where num > 700000 on DUPLICATE KEY UPDATE count=count+1;
+INSERT into t2 (num,count) SELECT NULL,count(*) from t1 where num > 700000 on DUPLICATE KEY UPDATE count=count+1;
+set tokudb_bulk_fetch=OFF;
+INSERT into t2 (num,count) SELECT NULL,count(*) from t1 where num > 700000 on DUPLICATE KEY UPDATE count=count+1;
+INSERT into t2 (num,count) SELECT NULL,count(*) from t1 where num > 700000 on DUPLICATE KEY UPDATE count=count+1;
+INSERT into t2 (num,count) SELECT NULL,count(*) from t1 where num > 700000 on DUPLICATE KEY UPDATE count=count+1;
+INSERT into t2 (num,count) SELECT NULL,count(*) from t1 where num > 700000 on DUPLICATE KEY UPDATE count=count+1;
+INSERT into t2 (num,count) SELECT NULL,count(*) from t1 where num > 700000 on DUPLICATE KEY UPDATE count=count+1;
+INSERT into t2 (num,count) SELECT NULL,count(*) from t1 where num > 700000 on DUPLICATE KEY UPDATE count=count+1;
+INSERT into t2 (num,count) SELECT NULL,count(*) from t1 where num > 700000 on DUPLICATE KEY UPDATE count=count+1;
+INSERT into t2 (num,count) SELECT NULL,count(*) from t1 where num > 700000 on DUPLICATE KEY UPDATE count=count+1;
+INSERT into t2 (num,count) SELECT NULL,count(*) from t1 where num > 700000 on DUPLICATE KEY UPDATE count=count+1;
+INSERT into t2 (num,count) SELECT NULL,count(*) from t1 where num > 700000 on DUPLICATE KEY UPDATE count=count+1;
+INSERT into t2 (num,count) SELECT NULL,count(*) from t1 where num > 700000 on DUPLICATE KEY UPDATE count=count+1;
+INSERT into t2 (num,count) SELECT NULL,count(*) from t1 where num > 700000 on DUPLICATE KEY UPDATE count=count+1;
+INSERT into t2 (num,count) SELECT NULL,count(*) from t1 where num > 700000 on DUPLICATE KEY UPDATE count=count+1;
+INSERT into t2 (num,count) SELECT NULL,count(*) from t1 where num > 700000 on DUPLICATE KEY UPDATE count=count+1;
+INSERT into t2 (num,count) SELECT NULL,count(*) from t1 where num > 700000 on DUPLICATE KEY UPDATE count=count+1;
+INSERT into t2 (num,count) SELECT NULL,count(*) from t1 where num > 700000 on DUPLICATE KEY UPDATE count=count+1;
+INSERT into t2 (num,count) SELECT NULL,count(*) from t1 where num > 700000 on DUPLICATE KEY UPDATE count=count+1;
+INSERT into t2 (num,count) SELECT NULL,count(*) from t1 where num > 700000 on DUPLICATE KEY UPDATE count=count+1;
+INSERT into t2 (num,count) SELECT NULL,count(*) from t1 where num > 700000 on DUPLICATE KEY UPDATE count=count+1;
+INSERT into t2 (num,count) SELECT NULL,count(*) from t1 where num > 700000 on DUPLICATE KEY UPDATE count=count+1;
 1
-drop table t,t1,t2;
+drop table t1,t2;
diff --git a/mysql-test/suite/tokudb/r/bf_replace_select.result b/mysql-test/suite/tokudb/r/bf_replace_select.result
index eab0f103ed6..a175797685c 100644
--- a/mysql-test/suite/tokudb/r/bf_replace_select.result
+++ b/mysql-test/suite/tokudb/r/bf_replace_select.result
@@ -1,75 +1,69 @@
 set default_storage_engine='tokudb';
-drop table if exists t,t1,t2;
-CREATE TABLE `t` (
+drop table if exists t1,t2;
+CREATE TABLE `t1` (
 `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` (
 `count` bigint(20) NOT NULL
-) ENGINE=TokuDB DEFAULT CHARSET=latin1;
-SELECT count(*) from t1;
+);
+INSERT INTO t1 values (null,null);
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+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
+1048576
+set tokudb_bulk_fetch=ON;
+REPLACE into t2 SELECT count(*) from t1;
+REPLACE into t2 SELECT count(*) from t1;
+REPLACE into t2 SELECT count(*) from t1;
+REPLACE into t2 SELECT count(*) from t1;
+REPLACE into t2 SELECT count(*) from t1;
+REPLACE into t2 SELECT count(*) from t1;
+REPLACE into t2 SELECT count(*) from t1;
+REPLACE into t2 SELECT count(*) from t1;
+REPLACE into t2 SELECT count(*) from t1;
+REPLACE into t2 SELECT count(*) from t1;
+REPLACE into t2 SELECT count(*) from t1;
+REPLACE into t2 SELECT count(*) from t1;
+REPLACE into t2 SELECT count(*) from t1;
+REPLACE into t2 SELECT count(*) from t1;
+REPLACE into t2 SELECT count(*) from t1;
+REPLACE into t2 SELECT count(*) from t1;
+REPLACE into t2 SELECT count(*) from t1;
+REPLACE into t2 SELECT count(*) from t1;
+REPLACE into t2 SELECT count(*) from t1;
+REPLACE into t2 SELECT count(*) from t1;
+set tokudb_bulk_fetch=OFF;
+REPLACE into t2 SELECT count(*) from t1;
+REPLACE into t2 SELECT count(*) from t1;
+REPLACE into t2 SELECT count(*) from t1;
+REPLACE into t2 SELECT count(*) from t1;
+REPLACE into t2 SELECT count(*) from t1;
+REPLACE into t2 SELECT count(*) from t1;
+REPLACE into t2 SELECT count(*) from t1;
+REPLACE into t2 SELECT count(*) from t1;
+REPLACE into t2 SELECT count(*) from t1;
+REPLACE into t2 SELECT count(*) from t1;
 REPLACE into t2 SELECT count(*) from t1;
 REPLACE into t2 SELECT count(*) from t1;
 REPLACE into t2 SELECT count(*) from t1;
@@ -81,287 +75,47 @@ REPLACE into t2 SELECT count(*) from t1;
 REPLACE into t2 SELECT count(*) from t1;
 REPLACE into t2 SELECT count(*) from t1;
 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
-INSERT IGNORE into t2 SELECT count(*) from t1;
-INSERT IGNORE into t2 SELECT count(*) from t1;
-INSERT IGNORE into t2 SELECT count(*) from t1;
-INSERT IGNORE into t2 SELECT count(*) from t1;
-INSERT IGNORE into t2 SELECT count(*) from t1;
-INSERT IGNORE into t2 SELECT count(*) from t1;
-INSERT IGNORE into t2 SELECT count(*) from t1;
-INSERT IGNORE into t2 SELECT count(*) from t1;
-INSERT IGNORE into t2 SELECT count(*) from t1;
-INSERT IGNORE into t2 SELECT count(*) from t1;
+set tokudb_bulk_fetch=ON;
+REPLACE into t2 SELECT count(*) from t1 where num > 700000;
+REPLACE into t2 SELECT count(*) from t1 where num > 700000;
+REPLACE into t2 SELECT count(*) from t1 where num > 700000;
+REPLACE into t2 SELECT count(*) from t1 where num > 700000;
+REPLACE into t2 SELECT count(*) from t1 where num > 700000;
+REPLACE into t2 SELECT count(*) from t1 where num > 700000;
+REPLACE into t2 SELECT count(*) from t1 where num > 700000;
+REPLACE into t2 SELECT count(*) from t1 where num > 700000;
+REPLACE into t2 SELECT count(*) from t1 where num > 700000;
+REPLACE into t2 SELECT count(*) from t1 where num > 700000;
+REPLACE into t2 SELECT count(*) from t1 where num > 700000;
+REPLACE into t2 SELECT count(*) from t1 where num > 700000;
+REPLACE into t2 SELECT count(*) from t1 where num > 700000;
+REPLACE into t2 SELECT count(*) from t1 where num > 700000;
+REPLACE into t2 SELECT count(*) from t1 where num > 700000;
+REPLACE into t2 SELECT count(*) from t1 where num > 700000;
+REPLACE into t2 SELECT count(*) from t1 where num > 700000;
+REPLACE into t2 SELECT count(*) from t1 where num > 700000;
+REPLACE into t2 SELECT count(*) from t1 where num > 700000;
+REPLACE into t2 SELECT count(*) from t1 where num > 700000;
+set tokudb_bulk_fetch=OFF;
+REPLACE into t2 SELECT count(*) from t1 where num > 700000;
+REPLACE into t2 SELECT count(*) from t1 where num > 700000;
+REPLACE into t2 SELECT count(*) from t1 where num > 700000;
+REPLACE into t2 SELECT count(*) from t1 where num > 700000;
+REPLACE into t2 SELECT count(*) from t1 where num > 700000;
+REPLACE into t2 SELECT count(*) from t1 where num > 700000;
+REPLACE into t2 SELECT count(*) from t1 where num > 700000;
+REPLACE into t2 SELECT count(*) from t1 where num > 700000;
+REPLACE into t2 SELECT count(*) from t1 where num > 700000;
+REPLACE into t2 SELECT count(*) from t1 where num > 700000;
+REPLACE into t2 SELECT count(*) from t1 where num > 700000;
+REPLACE into t2 SELECT count(*) from t1 where num > 700000;
+REPLACE into t2 SELECT count(*) from t1 where num > 700000;
+REPLACE into t2 SELECT count(*) from t1 where num > 700000;
+REPLACE into t2 SELECT count(*) from t1 where num > 700000;
+REPLACE into t2 SELECT count(*) from t1 where num > 700000;
+REPLACE into t2 SELECT count(*) from t1 where num > 700000;
+REPLACE into t2 SELECT count(*) from t1 where num > 700000;
+REPLACE into t2 SELECT count(*) from t1 where num > 700000;
+REPLACE into t2 SELECT count(*) from t1 where num > 700000;
 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
-REPLACE into t2 SELECT count(*) from t1 where num > 7000000;
-REPLACE into t2 SELECT count(*) from t1 where num > 7000000;
-REPLACE into t2 SELECT count(*) from t1 where num > 7000000;
-REPLACE into t2 SELECT count(*) from t1 where num > 7000000;
-REPLACE into t2 SELECT count(*) from t1 where num > 7000000;
-REPLACE into t2 SELECT count(*) from t1 where num > 7000000;
-REPLACE into t2 SELECT count(*) from t1 where num > 7000000;
-REPLACE into t2 SELECT count(*) from t1 where num > 7000000;
-REPLACE into t2 SELECT count(*) from t1 where num > 7000000;
-REPLACE into t2 SELECT count(*) from t1 where num > 7000000;
-REPLACE into t2 SELECT count(*) from t1 where num > 7000000;
-REPLACE into t2 SELECT count(*) from t1 where num > 7000000;
-REPLACE into t2 SELECT count(*) from t1 where num > 7000000;
-REPLACE into t2 SELECT count(*) from t1 where num > 7000000;
-REPLACE into t2 SELECT count(*) from t1 where num > 7000000;
-REPLACE into t2 SELECT count(*) from t1 where num > 7000000;
-REPLACE into t2 SELECT count(*) from t1 where num > 7000000;
-REPLACE into t2 SELECT count(*) from t1 where num > 7000000;
-REPLACE into t2 SELECT count(*) from t1 where num > 7000000;
-REPLACE into t2 SELECT count(*) from t1 where num > 7000000;
-REPLACE into t2 SELECT count(*) from t1 where num > 7000000;
-REPLACE into t2 SELECT count(*) from t1 where num > 7000000;
-REPLACE into t2 SELECT count(*) from t1 where num > 7000000;
-REPLACE into t2 SELECT count(*) from t1 where num > 7000000;
-REPLACE into t2 SELECT count(*) from t1 where num > 7000000;
-REPLACE into t2 SELECT count(*) from t1 where num > 7000000;
-REPLACE into t2 SELECT count(*) from t1 where num > 7000000;
-REPLACE into t2 SELECT count(*) from t1 where num > 7000000;
-REPLACE into t2 SELECT count(*) from t1 where num > 7000000;
-REPLACE into t2 SELECT count(*) from t1 where num > 7000000;
-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
-INSERT IGNORE into t2 SELECT count(*) from t1 where num > 7000000;
-INSERT IGNORE into t2 SELECT count(*) from t1 where num > 7000000;
-INSERT IGNORE into t2 SELECT count(*) from t1 where num > 7000000;
-INSERT IGNORE into t2 SELECT count(*) from t1 where num > 7000000;
-INSERT IGNORE into t2 SELECT count(*) from t1 where num > 7000000;
-INSERT IGNORE into t2 SELECT count(*) from t1 where num > 7000000;
-INSERT IGNORE into t2 SELECT count(*) from t1 where num > 7000000;
-INSERT IGNORE into t2 SELECT count(*) from t1 where num > 7000000;
-INSERT IGNORE into t2 SELECT count(*) from t1 where num > 7000000;
-INSERT IGNORE into t2 SELECT count(*) from t1 where num > 7000000;
-INSERT IGNORE into t2 SELECT count(*) from t1 where num > 7000000;
-INSERT IGNORE into t2 SELECT count(*) from t1 where num > 7000000;
-INSERT IGNORE into t2 SELECT count(*) from t1 where num > 7000000;
-INSERT IGNORE into t2 SELECT count(*) from t1 where num > 7000000;
-INSERT IGNORE into t2 SELECT count(*) from t1 where num > 7000000;
-INSERT IGNORE into t2 SELECT count(*) from t1 where num > 7000000;
-INSERT IGNORE into t2 SELECT count(*) from t1 where num > 7000000;
-INSERT IGNORE into t2 SELECT count(*) from t1 where num > 7000000;
-INSERT IGNORE into t2 SELECT count(*) from t1 where num > 7000000;
-INSERT IGNORE into t2 SELECT count(*) from t1 where num > 7000000;
-INSERT IGNORE into t2 SELECT count(*) from t1 where num > 7000000;
-INSERT IGNORE into t2 SELECT count(*) from t1 where num > 7000000;
-INSERT IGNORE into t2 SELECT count(*) from t1 where num > 7000000;
-INSERT IGNORE into t2 SELECT count(*) from t1 where num > 7000000;
-INSERT IGNORE into t2 SELECT count(*) from t1 where num > 7000000;
-INSERT IGNORE into t2 SELECT count(*) from t1 where num > 7000000;
-INSERT IGNORE into t2 SELECT count(*) from t1 where num > 7000000;
-INSERT IGNORE into t2 SELECT count(*) from t1 where num > 7000000;
-INSERT IGNORE into t2 SELECT count(*) from t1 where num > 7000000;
-INSERT IGNORE into t2 SELECT count(*) from t1 where num > 7000000;
-1
-drop table t,t1,t2;
+drop table t1,t2;
diff --git a/mysql-test/suite/tokudb/r/bf_select_range_part.result b/mysql-test/suite/tokudb/r/bf_select_range_part.result
index c13324aa34e..cc6c16bc92a 100644
--- a/mysql-test/suite/tokudb/r/bf_select_range_part.result
+++ b/mysql-test/suite/tokudb/r/bf_select_range_part.result
@@ -98,6 +98,36 @@ count(*)
 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(*)
@@ -159,6 +189,36 @@ count(*)
 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;
@@ -221,6 +281,36 @@ count(*)
 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(*)
@@ -282,5 +372,35 @@ count(*)
 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.test b/mysql-test/suite/tokudb/t/bf_create_select.test
index a8b7f9c9f6a..20455da874f 100644
--- a/mysql-test/suite/tokudb/t/bf_create_select.test
+++ b/mysql-test/suite/tokudb/t/bf_create_select.test
@@ -6,64 +6,56 @@ source include/have_tokudb.inc;
 source include/big_test.inc;
 set default_storage_engine='tokudb';
 disable_warnings;
-drop table if exists t,t1,t2;
+drop table if exists t1,t2;
 enable_warnings;
 
-let $maxq = 10;
+let $debug = 0;
 
-CREATE TABLE `t` (
+CREATE TABLE `t1` (
   `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;
+# put 1M rows into t1
+INSERT INTO t1 values (null,null);
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+SELECT count(*) FROM t1;
 
-# 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;
-
-let $s = `select to_seconds(now())`;
+let $maxq = 10;
+    
+set tokudb_bulk_fetch=ON;
+let $s = `select unix_timestamp()`;
 let $i = 0;
 while ($i < $maxq) {
-    SELECT count(*) from t1;
+    CREATE TABLE t2 AS SELECT count(*) from t1;
+    DROP TABLE t2;
     inc $i;
 }
-let $time_elapsed_select = `select to_seconds(now()) - $s`;
+let $time_elapsed_on = `select unix_timestamp() - $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())`;
+set tokudb_bulk_fetch=OFF;
+let $s = `select unix_timestamp()`;
 let $i = 0;
 while ($i < $maxq) {
     CREATE TABLE t2 AS SELECT count(*) from t1;
@@ -71,48 +63,41 @@ while ($i < $maxq) {
     inc $i;
 }
 
-let $time_elapsed_create_select = `select to_seconds(now()) - $s`;
+let $time_elapsed_off = `select unix_timestamp() - $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_create_select seconds.;
-
-# This check evaluates whether the time elapsed during the create select statement is on par
-# with the select statement, which will confirm that bulk fetch is in fact being used.
-let $verdict = `select abs($time_elapsed_create_select - $time_elapsed_select) <= $time_elapsed_select`;
+# Check that the time with bulk fetch off is at least twice that whith bulk fetch on
+let $verdict = `select $time_elapsed_on > 0 && $time_elapsed_off >= 2 * $time_elapsed_on`;
 echo $verdict;
+if ($debug) { echo index $verdict $time_elapsed_on $time_elapsed_off; }
+if (!$verdict) { echo index $time_elapsed_on $time_elapsed_off; }
 
-let $maxrq = 30;
+let $maxq = 30;
 
-let $s = `select to_seconds(now())`;
+set tokudb_bulk_fetch=ON;
+let $s = `select unix_timestamp()`;
 let $i = 0;
-while ($i < $maxrq) {
-    SELECT count(*) from t1 where num > 7000000;
+while ($i < $maxq) {
+    CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+    DROP TABLE t2;
     inc $i;
 }
-let $time_elapsed_select = `select to_seconds(now()) - $s`;
+let $time_elapsed_on = `select unix_timestamp() - $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())`;
+set tokudb_bulk_fetch=OFF;
+let $s = `select unix_timestamp()`;
 let $i = 0;
-while ($i < $maxrq) {
-    CREATE TABLE t2 AS SELECT count(*) from t1 where num > 7000000;
+while ($i < $maxq) {
+    CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
     DROP TABLE t2;
     inc $i;
 }
 
-let $time_elapsed_create_select = `select to_seconds(now()) - $s`;
+let $time_elapsed_off = `select unix_timestamp() - $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_create_select seconds.;
-
-# This check evaluates whether the time elapsed during the create select statement is on par
-# with the select statement, which will confirm that bulk fetch is in fact being used.
-let $verdict = `select abs($time_elapsed_create_select - $time_elapsed_select) <= $time_elapsed_select`;
+# Check that the time with bulk fetch off is at least twice that whith bulk fetch on
+let $verdict = `select $time_elapsed_on > 0 && $time_elapsed_off >= 2 * $time_elapsed_on`;
 echo $verdict;
+if ($debug) { echo range $verdict $time_elapsed_on $time_elapsed_off; }
+if (!$verdict) { echo range $time_elapsed_on $time_elapsed_off; }
 
-drop table t,t1;
+drop table t1;
diff --git a/mysql-test/suite/tokudb/t/bf_create_select_hash_part.test b/mysql-test/suite/tokudb/t/bf_create_select_hash_part.test
index b9ec8c52aa8..196ef48312d 100644
--- a/mysql-test/suite/tokudb/t/bf_create_select_hash_part.test
+++ b/mysql-test/suite/tokudb/t/bf_create_select_hash_part.test
@@ -7,137 +7,96 @@ 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;
+drop table if exists t1,t2;
 enable_warnings;
 
-let $maxq = 10;
+let $debug = 0;
 
-CREATE TABLE `t` (
+# Create source hash partitioned table from source table t
+CREATE TABLE `t1` (
   `num` int(10) unsigned auto_increment NOT NULL,
   `val` varchar(32) DEFAULT NULL,
   PRIMARY KEY (`num`)
-);
+) PARTITION BY HASH (num) PARTITIONS 8;
 
-# 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;
+# put 1M rows into t1
+INSERT INTO t1 values (null,null);
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+SELECT count(*) FROM t1;
 
-# Create base table (control 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;
+let $maxq = 20;
 
-# Create source hash partitioned 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;
-
-let $s = `select to_seconds(now())`;
+set tokudb_bulk_fetch=ON;
+let $s = `select unix_timestamp()`;
 let $i = 0;
 while ($i < $maxq) {
-    CREATE TABLE `t3` (`x` bigint);
-    SELECT count(*) from t1;
-    DROP TABLE t3;
+    CREATE TABLE t2 AS SELECT count(*) from t1;
+    DROP TABLE t2;
     inc $i;
 }
-let $time_elapsed_select = `select to_seconds(now()) - $s`;
+let $time_elapsed_on = `select unix_timestamp() - $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())`;
+set tokudb_bulk_fetch=OFF;
+let $s = `select unix_timestamp()`;
 let $i = 0;
 while ($i < $maxq) {
-    CREATE TABLE t3 AS SELECT count(*) from t2;
-    DROP TABLE t3;
+    CREATE TABLE t2 AS SELECT count(*) from t1;
+    DROP TABLE t2;
     inc $i;
 }
+let $time_elapsed_off = `select unix_timestamp() - $s`;
 
-let $time_elapsed_create_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_create_select seconds.;
-
-# This check evaluates whether the time elapsed during the create select statement is on par
-# with the select statement, which will confirm that bulk fetch is in fact being used.
-# Additionally, it is important to note that 1.5 is the multiplier applied to the time_elapsed_select
-# value because it appears that MySQL 5.5.39 uses a sorted index scan during the create select statement
-# while Percona Server 5.6 uses an unsorted index scan.
-# The issue has been resolved in MySQL 5.6 but still persists in Maria 10.0.12
-# in the defect found at https://mariadb.atlassian.net/browse/MDEV-6547.
-let $verdict = `select abs($time_elapsed_create_select - $time_elapsed_select) <= 1.5 * $time_elapsed_select`;
+# check that bulk fetch on is at least 2 times faster than bulk fetch off
+let $verdict = `select $time_elapsed_on > 0 && $time_elapsed_off >= 2 * $time_elapsed_on`;
 echo $verdict;
-if (!$verdict) { echo index scan t2 $time_elapsed_create_select $time_elapsed_select; }
+if ($debug) { echo index $verdict $time_elapsed_off $time_elapsed_on; }
+if (!$verdict) { echo index $time_elapsed_off $time_elapsed_on; }
 
-let $maxrq = 30;
+let $maxq = 20;
 
-let $s = `select to_seconds(now())`;
+set tokudb_bulk_fetch=ON;
+let $s = `select unix_timestamp()`;
 let $i = 0;
-while ($i < $maxrq) {
-    CREATE TABLE `t3` (`x` bigint); 
-    SELECT count(*) from t1 where num > 7000000;
-    DROP TABLE t3;
+while ($i < $maxq) {
+    CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+    DROP TABLE t2;
     inc $i;
 }
-let $time_elapsed_select = `select to_seconds(now()) - $s`;
+let $time_elapsed_on = `select unix_timestamp() - $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())`;
+set tokudb_bulk_fetch=OFF;
+let $s = `select unix_timestamp()`;
 let $i = 0;
-while ($i < $maxrq) {
-    CREATE TABLE t3 AS SELECT count(*) from t2 where num > 7000000;
-    DROP TABLE t3;
+while ($i < $maxq) {
+    CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+    DROP TABLE t2;
     inc $i;
 }
+let $time_elapsed_off = `select unix_timestamp() - $s`;
 
-let $time_elapsed_create_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_create_select seconds.;
-
-# This check evaluates whether the time elapsed during the create select statement is on par
-# with the select statement, which will confirm that bulk fetch is in fact being used.
-# Additionally, it is important to note that 1.5 is the multiplier applied to the time_elapsed_select
-# value because it appears that MySQL 5.5.39 uses a sorted index scan during the create select statement
-# while Percona Server 5.6 uses an unsorted index scan.
-# The issue has been resolved in MySQL 5.6 but still persists in Maria 10.0.12
-# in the defect found at https://mariadb.atlassian.net/browse/MDEV-6547.
-let $verdict = `select abs($time_elapsed_create_select - $time_elapsed_select) <= 1.5 * $time_elapsed_select`;
+# check that bulk fetch on is at least 2 times faster than bulk fetch off
+let $verdict = `select $time_elapsed_on > 0 && $time_elapsed_off >= 2 * $time_elapsed_on`;
 echo $verdict;
-if (!$verdict) { echo range scan t2 $time_elapsed_create_select $time_elapsed_select; }
+if ($debug) { echo range $verdict $time_elapsed_off $time_elapsed_on; }
+if (!$verdict) { echo range $time_elapsed_off $time_elapsed_on; }
 
-drop table t,t1,t2;
+drop table t1;
diff --git a/mysql-test/suite/tokudb/t/bf_create_select_range_part.test b/mysql-test/suite/tokudb/t/bf_create_select_range_part.test
index a48f272b84f..b66b2c42808 100644
--- a/mysql-test/suite/tokudb/t/bf_create_select_range_part.test
+++ b/mysql-test/suite/tokudb/t/bf_create_select_range_part.test
@@ -7,132 +7,103 @@ source include/have_partition.inc;
 source include/big_test.inc;
 set default_storage_engine='tokudb';
 disable_warnings;
-drop table if exists t,t1,t2;
+drop table if exists t1,t2;
 enable_warnings;
 
-let $maxq = 10;
+let $debug = 0;
 
-CREATE TABLE `t` (
+CREATE TABLE `t1` (
   `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 base table (control 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 source range partitioned table from source table t
-CREATE TABLE `t2` (
-  `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;
+(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);
 
-let $s = `select to_seconds(now())`;
+# put 1M rows into t1
+INSERT INTO t1 values (null,null);
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+SELECT count(*) FROM t1;
+
+let $maxq = 20;
+
+set tokudb_bulk_fetch=ON;
+let $s = `select unix_timestamp()`;
 let $i = 0;
 while ($i < $maxq) {
-    CREATE TABLE `t3` (`x` bigint);
-    SELECT count(*) from t1;
-    DROP TABLE t3;
+    CREATE TABLE t2 AS SELECT count(*) from t1;
+    DROP TABLE t2;
     inc $i;
 }
-let $time_elapsed_select = `select to_seconds(now()) - $s`;
+let $time_elapsed_on = `select unix_timestamp() - $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())`;
+set tokudb_bulk_fetch=OFF;
+let $s = `select unix_timestamp()`;
 let $i = 0;
 while ($i < $maxq) {
-    CREATE TABLE t4 AS SELECT count(*) from t2;
-    DROP TABLE t4;
+    CREATE TABLE t2 AS SELECT count(*) from t1;
+    DROP TABLE t2;
     inc $i;
 }
+let $time_elapsed_off = `select unix_timestamp() - $s`;
 
-let $time_elapsed_create_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_create_select seconds.;
-
-# This check evaluates whether the time elapsed during the create select statement is on par
-# with the select statement, which will confirm that bulk fetch is in fact being used.
-let $verdict = `select abs($time_elapsed_create_select - $time_elapsed_select) <= $time_elapsed_select`;
+# check that bulk fetch on is at least 2 times faster than bulk fetch off
+let $verdict = `select $time_elapsed_on > 0 && $time_elapsed_off >= 2 * $time_elapsed_on`;
 echo $verdict;
+if ($debug) { echo index $verdict $time_elapsed_off $time_elapsed_on; }
+if (!$verdict) { echo index $time_elapsed_off $time_elapsed_on; }
 
-let $maxrq = 30;
+let $maxq = 20;
 
-let $s = `select to_seconds(now())`;
+set tokudb_bulk_fetch=ON;
+let $s = `select unix_timestamp()`;
 let $i = 0;
-while ($i < $maxrq) {
-    CREATE TABLE `t3` (`x` bigint);
-    SELECT count(*) from t1 where num > 7000000;
-    DROP TABLE t3;
+while ($i < $maxq) {
+    CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+    DROP TABLE t2;
     inc $i;
 }
-let $time_elapsed_select = `select to_seconds(now()) - $s`;
+let $time_elapsed_on = `select unix_timestamp() - $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())`;
+set tokudb_bulk_fetch=OFF;
+let $s = `select unix_timestamp()`;
 let $i = 0;
-while ($i < $maxrq) {
-    CREATE TABLE t4 AS SELECT count(*) from t2 where num > 7000000;
-    DROP TABLE t4;
+while ($i < $maxq) {
+    CREATE TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+    DROP TABLE t2;
     inc $i;
 }
+let $time_elapsed_off = `select unix_timestamp() - $s`;
 
-let $time_elapsed_create_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_create_select seconds.;
-
-# This check evaluates whether the time elapsed during the create select statement is on par
-# with the select statement, which will confirm that bulk fetch is in fact being used.
-let $verdict = `select abs($time_elapsed_create_select - $time_elapsed_select) <= $time_elapsed_select`;
+# check that bulk fetch on is at least 2 times faster than bulk fetch off
+let $verdict = `select $time_elapsed_on > 0 && $time_elapsed_off >= 2 * $time_elapsed_on`;
 echo $verdict;
+if ($debug) { echo range $verdict $time_elapsed_off $time_elapsed_on; }
+if (!$verdict) { echo range $time_elapsed_off $time_elapsed_on; }
 
-drop table t,t1,t2;
+drop table t1;
diff --git a/mysql-test/suite/tokudb/t/bf_create_temp_select.test b/mysql-test/suite/tokudb/t/bf_create_temp_select.test
index fdd665076c9..52cb886a410 100644
--- a/mysql-test/suite/tokudb/t/bf_create_temp_select.test
+++ b/mysql-test/suite/tokudb/t/bf_create_temp_select.test
@@ -1,118 +1,103 @@
 # Verify that index and range scans are not slow
-# on temporary tables during create select statements
+# on tables during create select statements
 # due to tokudb bulk fetch not being used
 
 source include/have_tokudb.inc;
 source include/big_test.inc;
 set default_storage_engine='tokudb';
 disable_warnings;
-drop table if exists t,t1,t2;
+drop table if exists t1,t2;
 enable_warnings;
 
-let $maxq = 10;
+let $debug = 0;
 
-CREATE TABLE `t` (
+CREATE TABLE `t1` (
   `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;
+# put 1M rows into t1
+INSERT INTO t1 values (null,null);
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+SELECT count(*) FROM t1;
 
-# 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;
-
-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 $maxq = 10;
+    
+set tokudb_bulk_fetch=ON;
+let $s = `select unix_timestamp()`;
 let $i = 0;
 while ($i < $maxq) {
     CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1;
-    DROP TEMPORARY TABLE t2;
+    DROP TABLE t2;
     inc $i;
 }
+let $time_elapsed_on = `select unix_timestamp() - $s`;
 
-let $time_elapsed_create_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_create_select seconds.;
-
-# This check evaluates whether the time elapsed during the create select statement is on par
-# with the select statement, which will confirm that bulk fetch is in fact being used.
-let $verdict = `select abs($time_elapsed_create_select - $time_elapsed_select) <= $time_elapsed_select`;
-echo $verdict;
-
-let $maxrq = 30;
-
-let $s = `select to_seconds(now())`;
+set tokudb_bulk_fetch=OFF;
+let $s = `select unix_timestamp()`;
 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 Range scans took $time_elapsed_select seconds.;
-
-let $s = `select to_seconds(now())`;
-let $i = 0;
-while ($i < $maxrq) {
-    CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 7000000;
-    DROP TEMPORARY TABLE t2;
+while ($i < $maxq) {
+    CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1;
+    DROP TABLE t2;
     inc $i;
 }
 
-let $time_elapsed_create_select = `select to_seconds(now()) - $s`;
+let $time_elapsed_off = `select unix_timestamp() - $s`;
 
-# The following line can be used to display the time elapsed data
-# which could be useful for debugging.
-#echo Range scans took $time_elapsed_create_select seconds.;
-
-# This check evaluates whether the time elapsed during the create select statement is on par
-# with the select statement, which will confirm that bulk fetch is in fact being used.
-let $verdict = `select abs($time_elapsed_create_select - $time_elapsed_select) <= $time_elapsed_select`;
+# Check that the time with bulk fetch off is at least twice that whith bulk fetch on
+let $verdict = `select $time_elapsed_on > 0 && $time_elapsed_off >= 2 * $time_elapsed_on`;
 echo $verdict;
+if ($debug) { echo index $verdict $time_elapsed_on $time_elapsed_off; }
+if (!$verdict) { echo index $time_elapsed_on $time_elapsed_off; }
 
-drop table t,t1;
+let $maxq = 30;
+
+set tokudb_bulk_fetch=ON;
+let $s = `select unix_timestamp()`;
+let $i = 0;
+while ($i < $maxq) {
+    CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+    DROP TABLE t2;
+    inc $i;
+}
+let $time_elapsed_on = `select unix_timestamp() - $s`;
+
+set tokudb_bulk_fetch=OFF;
+let $s = `select unix_timestamp()`;
+let $i = 0;
+while ($i < $maxq) {
+    CREATE TEMPORARY TABLE t2 AS SELECT count(*) from t1 where num > 700000;
+    DROP TABLE t2;
+    inc $i;
+}
+
+let $time_elapsed_off = `select unix_timestamp() - $s`;
+
+# Check that the time with bulk fetch off is at least twice that whith bulk fetch on
+let $verdict = `select $time_elapsed_on > 0 && $time_elapsed_off >= 2 * $time_elapsed_on`;
+echo $verdict;
+if ($debug) { echo range $verdict $time_elapsed_on $time_elapsed_off; }
+if (!$verdict) { echo range $time_elapsed_on $time_elapsed_off; }
+
+drop table t1;
diff --git a/mysql-test/suite/tokudb/t/bf_delete.test b/mysql-test/suite/tokudb/t/bf_delete.test
index 65b26df230e..f98e87f1ec1 100644
--- a/mysql-test/suite/tokudb/t/bf_delete.test
+++ b/mysql-test/suite/tokudb/t/bf_delete.test
@@ -8,6 +8,8 @@ disable_warnings;
 drop table if exists t;
 enable_warnings;
 
+let $debug = 0;
+
 CREATE TABLE `t` (id bigint not null auto_increment primary key, val bigint not null default 0);
 
 # put 8M rows into t
@@ -42,27 +44,28 @@ let $maxq = 10;
 
 # measure the time to do $maxq deletes from t that affect no rows with bulk fetch ON
 set tokudb_bulk_fetch = ON;
-let $s = `select to_seconds(now())`;
+let $s = `select unix_timestamp()`;
 let $i = 0;
 while ($i < $maxq) {
     delete from t where val > 0;
     inc $i;
 }
-let $time_elapsed_bf_on = `select to_seconds(now()) - $s`;
+let $time_elapsed_bf_on = `select unix_timestamp() - $s`;
 
 # measure the time to do $maxq deletes from t that affect no rows with bulk fetch OFF
 set tokudb_bulk_fetch = OFF;
-let $s = `select to_seconds(now())`;
+let $s = `select unix_timestamp()`;
 let $i = 0;
 while ($i < $maxq) {
     delete from t where val > 0;
     inc $i;
 }
-let $time_elapsed_bf_off = `select to_seconds(now()) - $s`;
+let $time_elapsed_bf_off = `select unix_timestamp() - $s`;
 
 # verify that a delete scan with bulk fetch ON is at least 2 times faster than with bulk fetch OFF
-let $verdict = `select $time_elapsed_bf_off > $time_elapsed_bf_on && ($time_elapsed_bf_off - $time_elapsed_bf_on) / $time_elapsed_bf_on >= 2`;
+let $verdict = `select $time_elapsed_bf_on > 0 && $time_elapsed_bf_off >= 2 * $time_elapsed_bf_on`;
 echo $verdict;
-if (!$verdict) { echo $time_elapsed_bf_on $time_elapsed_bf_off; }
+if ($debug) { echo range $verdict $time_elapsed_bf_on $time_elapsed_bf_off; }
+if (!$verdict) { echo range $time_elapsed_bf_on $time_elapsed_bf_off; }
 
 drop table t;
diff --git a/mysql-test/suite/tokudb/t/bf_insert_select.test b/mysql-test/suite/tokudb/t/bf_insert_select.test
index 11f14013a30..5fcb8fa58b5 100644
--- a/mysql-test/suite/tokudb/t/bf_insert_select.test
+++ b/mysql-test/suite/tokudb/t/bf_insert_select.test
@@ -6,117 +6,95 @@ source include/have_tokudb.inc;
 source include/big_test.inc;
 set default_storage_engine='tokudb';
 disable_warnings;
-drop table if exists t,t1,t2;
+drop table if exists t1,t2;
 enable_warnings;
 
-let $maxq = 10;
+let $debug = 0;
 
-CREATE TABLE `t` (
+CREATE TABLE `t1` (
   `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 t2 that will serve as the target for the insert select statment
 CREATE TABLE `t2` (
   `count` bigint(20) NOT NULL
-  ) ENGINE=TokuDB DEFAULT CHARSET=latin1;
+);
 
+# put 1M rows into t1
+INSERT INTO t1 values (null,null);
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+SELECT count(*) FROM t1;
 
-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`;
+let $maxq = 20;
 
-# 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())`;
+set tokudb_bulk_fetch=ON;
+let $s = `select unix_timestamp()`;
 let $i = 0;
 while ($i < $maxq) {
     INSERT into t2 SELECT count(*) from t1;
     inc $i;
 }
-let $time_elapsed_insert_select = `select to_seconds(now()) - $s`;
+let $time_elapsed_on = `select unix_timestamp() - $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_insert_select seconds.;
-
-# This check evaluates whether the time elapsed during the insert select statement is on par
-# with the select statement, which will confirm that bulk fetch is in fact being used.
-let $verdict = `select abs($time_elapsed_insert_select - $time_elapsed_select) <= $time_elapsed_select`;
-echo $verdict;
-
-let $maxrq = 30;
-
-let $s = `select to_seconds(now())`;
+set tokudb_bulk_fetch=OFF;
+let $s = `select unix_timestamp()`;
 let $i = 0;
-while ($i < $maxrq) {
-    SELECT count(*) from t1 where num > 7000000;
+while ($i < $maxq) {
+    INSERT into t2 SELECT count(*) from t1;
     inc $i;
 }
-let $time_elapsed_select = `select to_seconds(now()) - $s`;
+let $time_elapsed_off = `select unix_timestamp() - $s`;
 
-# This check evaluates whether the time elapsed during the insert select statement is on par
-# with the select statement, which will confirm that bulk fetch is in fact being used.
-#echo Range scans took $time_elapsed_select seconds.;
+# check that bulk fetch on is at least 2 times faster than bulk fetch off
+let $verdict = `select $time_elapsed_on > 0 && $time_elapsed_off >= 2 * $time_elapsed_on`;
+echo $verdict;
+if ($debug) { echo index $verdict $time_elapsed_off $time_elapsed_on; }
+if (!$verdict) { echo index $time_elapsed_off $time_elapsed_on; }
 
+let $maxq = 20;
 
-let $s = `select to_seconds(now())`;
+set tokudb_bulk_fetch=ON;
+let $s = `select unix_timestamp()`;
 let $i = 0;
-while ($i < $maxrq) {
-    INSERT into t2 SELECT count(*) from t1 where num > 7000000;
+while ($i < $maxq) {
+    INSERT into t2 SELECT count(*) from t1 where num > 700000;
     inc $i;
 }
-let $time_elapsed_insert_select = `select to_seconds(now()) - $s`;
+let $time_elapsed_on = `select unix_timestamp() - $s`;
 
-# This check evaluates whether the time elapsed during the insert select statement is on par
-# with the select statement, which will confirm that bulk fetch is in fact being used.
-#echo Range scans took $time_elapsed_insert_select seconds.;
+set tokudb_bulk_fetch=OFF;
+let $s = `select unix_timestamp()`;
+let $i = 0;
+while ($i < $maxq) {
+    INSERT into t2 SELECT count(*) from t1 where num > 700000;
+    inc $i;
+}
+let $time_elapsed_off = `select unix_timestamp() - $s`;
 
-# This check evaluates whether the time elapsed during the insert select statement is on par
-# with the select statement, which will confirm that bulk fetch is in fact being used.
-let $verdict = `select abs($time_elapsed_insert_select - $time_elapsed_select) <= $time_elapsed_select`;
+let $verdict = `select $time_elapsed_on > 0 && $time_elapsed_off >= 2 * $time_elapsed_on`;
 echo $verdict;
+if ($debug) { echo range $verdict $time_elapsed_off $time_elapsed_on; }
+if (!$verdict) { echo range $time_elapsed_off $time_elapsed_on; }
 
-drop table t,t1,t2;
+drop table t1,t2;
diff --git a/mysql-test/suite/tokudb/t/bf_insert_select_dup_key.test b/mysql-test/suite/tokudb/t/bf_insert_select_dup_key.test
index 3200beeaba9..51c6d66d706 100644
--- a/mysql-test/suite/tokudb/t/bf_insert_select_dup_key.test
+++ b/mysql-test/suite/tokudb/t/bf_insert_select_dup_key.test
@@ -8,120 +8,98 @@ source include/have_tokudb.inc;
 source include/big_test.inc;
 set default_storage_engine='tokudb';
 disable_warnings;
-drop table if exists t,t1,t2;
+drop table if exists t1,t2;
 enable_warnings;
 
-let $maxq = 10;
+let $debug = 0;
 
-CREATE TABLE `t` (
+CREATE TABLE `t1` (
   `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;
+# put 1M rows into t1
+INSERT INTO t1 values (null,null);
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+SELECT count(*) FROM t1;
 
 # Create second table t2 that will serve as the target for the insert select statment
 CREATE TABLE `t2` (
   `num` int(10) unsigned auto_increment NOT NULL, 
   `count` bigint(20) NOT NULL,
   UNIQUE (num)
-  ) ENGINE=TokuDB DEFAULT CHARSET=latin1;
+);
 
+let $maxq = 20;
 
-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())`;
+set tokudb_bulk_fetch=ON;
+let $s = `select unix_timestamp()`;
 let $i = 0;
 while ($i < $maxq) {
     INSERT into t2 (num,count) SELECT NULL,count(*) from t1 on DUPLICATE KEY UPDATE count=count+1;
     inc $i;
 }
-let $time_elapsed_insert_select = `select to_seconds(now()) - $s`;
+let $time_elapsed_on = `select unix_timestamp() - $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_insert_select seconds.;
-
-# This check evaluates whether the time elapsed during the insert select on duplicate key statement is on par
-# with the select statement, which will confirm that bulk fetch is in fact being used.
-let $verdict = `select abs($time_elapsed_insert_select - $time_elapsed_select) <= $time_elapsed_select`;
-echo $verdict;
-
-let $maxrq = 30;
-
-let $s = `select to_seconds(now())`;
+set tokudb_bulk_fetch=OFF;
+let $s = `select unix_timestamp()`;
 let $i = 0;
-while ($i < $maxrq) {
-    SELECT count(*) from t1 where num > 7000000;
+while ($i < $maxq) {
+    INSERT into t2 (num,count) SELECT NULL,count(*) from t1 on DUPLICATE KEY UPDATE count=count+1;
     inc $i;
 }
-let $time_elapsed_select = `select to_seconds(now()) - $s`;
+let $time_elapsed_off = `select unix_timestamp() - $s`;
 
-# The following line can be used to display the time elapsed data
-# which could be useful for debugging.
-#echo Range scans took $time_elapsed_select seconds.;
+# check that bulk fetch on is at least 2 times faster than bulk fetch off
+let $verdict = `select $time_elapsed_on > 0 && $time_elapsed_off >= 2 * $time_elapsed_on`;
+echo $verdict;
+if ($debug) { echo index $verdict $time_elapsed_off $time_elapsed_on; }
+if (!$verdict) { echo index $time_elapsed_off $time_elapsed_on; }
 
+let $maxq = 20;
 
-let $s = `select to_seconds(now())`;
+set tokudb_bulk_fetch=ON;
+let $s = `select unix_timestamp()`;
 let $i = 0;
-while ($i < $maxrq) {
-    INSERT into t2 (num,count) SELECT NULL,count(*) from t1 where num > 7000000 on DUPLICATE KEY UPDATE count=count+1;
+while ($i < $maxq) {
+    INSERT into t2 (num,count) SELECT NULL,count(*) from t1 where num > 700000 on DUPLICATE KEY UPDATE count=count+1;
     inc $i;
 }
-let $time_elapsed_insert_select = `select to_seconds(now()) - $s`;
+let $time_elapsed_on = `select unix_timestamp() - $s`;
 
-# The following line can be used to display the time elapsed data
-# which could be useful for debugging.
-#echo Range scans took $time_elapsed_insert_select seconds.;
+set tokudb_bulk_fetch=OFF;
+let $s = `select unix_timestamp()`;
+let $i = 0;
+while ($i < $maxq) {
+    INSERT into t2 (num,count) SELECT NULL,count(*) from t1 where num > 700000 on DUPLICATE KEY UPDATE count=count+1;
+    inc $i;
+}
+let $time_elapsed_off = `select unix_timestamp() - $s`;
 
-# This check evaluates whether the time elapsed during the insert select on duplicate key statement is on par
-# with the select statement, which will confirm that bulk fetch is in fact being used.
-let $verdict = `select abs($time_elapsed_insert_select - $time_elapsed_select) <= $time_elapsed_select`;
+# check that bulk fetch on is at least 2 times faster than bulk fetch off
+let $verdict = `select $time_elapsed_on > 0 && $time_elapsed_off >= 2 * $time_elapsed_on`;
 echo $verdict;
+if ($debug) { echo range $verdict $time_elapsed_off $time_elapsed_on; }
+if (!$verdict) { echo range $time_elapsed_off $time_elapsed_on; }
 
-enable_warnings;
-drop table t,t1,t2;
+drop table t1,t2;
diff --git a/mysql-test/suite/tokudb/t/bf_replace_select.test b/mysql-test/suite/tokudb/t/bf_replace_select.test
index 380eb5adda8..1ca754454eb 100644
--- a/mysql-test/suite/tokudb/t/bf_replace_select.test
+++ b/mysql-test/suite/tokudb/t/bf_replace_select.test
@@ -1,190 +1,100 @@
 # Verify that index and range scans are not slow
-# on tables during replace select and insert ignore statements
+# on tables during replace select statements
 # due to tokudb bulk fetch not being used
 
 source include/have_tokudb.inc;
 source include/big_test.inc;
 set default_storage_engine='tokudb';
 disable_warnings;
-drop table if exists t,t1,t2;
+drop table if exists t1,t2;
 enable_warnings;
 
-let $maxq = 10;
+let $debug = 0;
 
-CREATE TABLE `t` (
+CREATE TABLE `t1` (
   `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 t2 that will serve as the target for the replace select statment
+# Create second table t2 that will serve as the target for the insert select statment
 CREATE TABLE `t2` (
   `count` bigint(20) NOT NULL
-  ) ENGINE=TokuDB DEFAULT CHARSET=latin1;
+);
 
+# put 1M rows into t1
+INSERT INTO t1 values (null,null);
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+INSERT INTO t1 SELECT null,val FROM t1;
+SELECT count(*) FROM t1;
 
-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`;
+let $maxq = 20;
 
-# 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())`;
+set tokudb_bulk_fetch=ON;
+let $s = `select unix_timestamp()`;
 let $i = 0;
 while ($i < $maxq) {
     REPLACE into t2 SELECT count(*) from t1;
     inc $i;
 }
-let $time_elapsed_replace_select = `select to_seconds(now()) - $s`;
+let $time_elapsed_on = `select unix_timestamp() - $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_replace_select seconds.;
-
-# This check evaluates whether the time elapsed during the replace select statement is on par
-# with the select statement, which will confirm that bulk fetch is in fact being used.
-let $verdict = `select abs($time_elapsed_replace_select - $time_elapsed_select) <= $time_elapsed_select`;
-echo $verdict;
-
-##############################################################
-
-let $s = `select to_seconds(now())`;
+set tokudb_bulk_fetch=OFF;
+let $s = `select unix_timestamp()`;
 let $i = 0;
 while ($i < $maxq) {
-    SELECT count(*) from t1;
+    REPLACE into t2 SELECT count(*) from t1;
     inc $i;
 }
-let $time_elapsed_select = `select to_seconds(now()) - $s`;
+let $time_elapsed_off = `select unix_timestamp() - $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.;
+# check that bulk fetch on is at least 2 times faster than bulk fetch off
+let $verdict = `select $time_elapsed_on > 0 && $time_elapsed_off >= 2 * $time_elapsed_on`;
+echo $verdict;
+if ($debug) { echo index $verdict $time_elapsed_off $time_elapsed_on; }
+if (!$verdict) { echo index $time_elapsed_off $time_elapsed_on; }
 
+let $maxq = 20;
 
-let $s = `select to_seconds(now())`;
+set tokudb_bulk_fetch=ON;
+let $s = `select unix_timestamp()`;
 let $i = 0;
 while ($i < $maxq) {
-    INSERT IGNORE into t2 SELECT count(*) from t1;
+    REPLACE into t2 SELECT count(*) from t1 where num > 700000;
     inc $i;
 }
-let $time_elapsed_insert_ignore_select = `select to_seconds(now()) - $s`;
+let $time_elapsed_on = `select unix_timestamp() - $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_insert_ignore_select seconds.;
+set tokudb_bulk_fetch=OFF;
+let $s = `select unix_timestamp()`;
+let $i = 0;
+while ($i < $maxq) {
+    REPLACE into t2 SELECT count(*) from t1 where num > 700000;
+    inc $i;
+}
+let $time_elapsed_off = `select unix_timestamp() - $s`;
 
-# This check evaluates whether the time elapsed during the insert ignore select statement is on par
-# with the select statement, which will confirm that bulk fetch is in fact being used.
-let $verdict = `select abs($time_elapsed_insert_ignore_select - $time_elapsed_select) <= $time_elapsed_select`;
+let $verdict = `select $time_elapsed_on > 0 && $time_elapsed_off >= 2 * $time_elapsed_on`;
 echo $verdict;
+if ($debug) { echo range $verdict $time_elapsed_off $time_elapsed_on; }
+if (!$verdict) { echo range $time_elapsed_off $time_elapsed_on; }
 
-##################################################################
-
-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 Range scans took $time_elapsed_select seconds.;
-
-
-let $s = `select to_seconds(now())`;
-let $i = 0;
-while ($i < $maxrq) {
-    REPLACE into t2 SELECT count(*) from t1 where num > 7000000;
-    inc $i;
-}
-let $time_elapsed_replace_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 Range scans took $time_elapsed_replace_select seconds.;
-
-# This check evaluates whether the time elapsed during the replace select statement is on par
-# with the select statement, which will confirm that bulk fetch is in fact being used.
-let $verdict = `select abs($time_elapsed_replace_select - $time_elapsed_select) <= $time_elapsed_select`;
-echo $verdict;
-
-####################################################################
-
-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 Range scans took $time_elapsed_select seconds.;
-
-
-let $s = `select to_seconds(now())`;
-let $i = 0;
-while ($i < $maxrq) {
-    INSERT IGNORE into t2 SELECT count(*) from t1 where num > 7000000;
-    inc $i;
-}
-let $time_elapsed_insert_ignore_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 Range scans took $time_elapsed_insert_ignore_select seconds.;
-
-# This check evaluates whether the time elapsed during the insert ignore select statement is on par
-# with the select statement, which will confirm that bulk fetch is in fact being used.
-let $verdict = `select abs($time_elapsed_insert_ignore_select - $time_elapsed_select) <= $time_elapsed_select`;
-echo $verdict;
-
-#########################################################################
-
-drop table t,t1,t2;
+drop table t1,t2;
diff --git a/mysql-test/suite/tokudb/t/bf_select_hash_part.test b/mysql-test/suite/tokudb/t/bf_select_hash_part.test
index 67fefcb45bd..2271a2086be 100644
--- a/mysql-test/suite/tokudb/t/bf_select_hash_part.test
+++ b/mysql-test/suite/tokudb/t/bf_select_hash_part.test
@@ -66,9 +66,10 @@ 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`;
+let $verdict = `select $time_bf_on > 0 && $time_bf_off >= 1.5 * $time_bf_on`;
 echo $verdict;
-if (!$verdict) { echo index scan $time_bf_on $time_bf_off; }
+if ($debug) { echo index $verdict $time_bf_on $time_bf_off; }
+if (!$verdict) { echo index $time_bf_on $time_bf_off; }
 
 set tokudb_bulk_fetch=ON;
 let $s = `select unix_timestamp()`;
@@ -93,8 +94,9 @@ 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`;
+let $verdict = `select $time_bf_on > 0 && $time_bf_off >= 1.5 * $time_bf_on`;
 echo $verdict;
-if (!$verdict) { echo range scan $time_bf_on $time_bf_off; }
+if ($debug) { echo range $verdict $time_bf_on $time_bf_off; }
+if (!$verdict) { echo range $time_bf_on $time_bf_off; }
 
 drop table t;
diff --git a/mysql-test/suite/tokudb/t/bf_select_range_part.test b/mysql-test/suite/tokudb/t/bf_select_range_part.test
index 0a1d7de3747..9dcb044d4d4 100644
--- a/mysql-test/suite/tokudb/t/bf_select_range_part.test
+++ b/mysql-test/suite/tokudb/t/bf_select_range_part.test
@@ -9,7 +9,6 @@ disable_warnings;
 drop table if exists t;
 enable_warnings;
 
-let $maxq = 20;
 let $debug = 0;
 
 # create the range partition table
@@ -51,6 +50,8 @@ INSERT INTO t SELECT null,val FROM t;
 INSERT INTO t SELECT null,val FROM t;
 SELECT count(*) FROM t;
 
+let $maxq = 30;
+
 set tokudb_bulk_fetch=ON;
 let $s = `select unix_timestamp()`;
 let $i = 0;
@@ -60,8 +61,6 @@ while ($i < $maxq) {
 }
 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;
@@ -71,11 +70,10 @@ while ($i < $maxq) {
 }
 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`;
+let $verdict = `select $time_bf_on > 0 && $time_bf_off >= 1.5 * $time_bf_on`;
 echo $verdict;
+if ($debug) { echo index $verdict $time_bf_on $time_bf_off; }
 if (!$verdict) { echo index scan $time_bf_on $time_bf_off; }
 
 set tokudb_bulk_fetch=ON;
@@ -87,8 +85,6 @@ while ($i < $maxq) {
 }
 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;
@@ -98,11 +94,10 @@ while ($i < $maxq) {
 }
 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`;
+let $verdict = `select $time_bf_on > 0 && $time_bf_off >= 1.5 * $time_bf_on`;
 echo $verdict;
-if (!$verdict) { echo range scan $time_bf_on $time_bf_off; }
+if ($debug) { echo range $verdict $time_bf_on $time_bf_off; }
+if (!$verdict) { echo range $time_bf_on $time_bf_off; }
 
 drop table t;