EVOLUTION-MANAGER
Edit File: bf_select_hash_part.test
# Verify that index and range scans on a hash partitioned tokudb table are not slow on tables # due to tokudb bulk fetch not being used. source include/have_tokudb.inc; source include/have_partition.inc; source include/big_test.inc; set default_storage_engine='tokudb'; disable_warnings; drop table if exists t; enable_warnings; let $maxq = 20; let $debug = 0; # create the hash partition table CREATE TABLE `t` ( `num` int(10) unsigned NOT NULL auto_increment, `val` varchar(32) DEFAULT NULL, PRIMARY KEY (`num`) ) PARTITION BY HASH (num) PARTITIONS 8; # put 1M rows into t INSERT INTO t values (null,null); INSERT INTO t SELECT null,val FROM t; INSERT INTO t SELECT null,val FROM t; INSERT INTO t SELECT null,val FROM t; INSERT INTO t SELECT null,val FROM t; INSERT INTO t SELECT null,val FROM t; INSERT INTO t SELECT null,val FROM t; INSERT INTO t SELECT null,val FROM t; INSERT INTO t SELECT null,val FROM t; INSERT INTO t SELECT null,val FROM t; INSERT INTO t SELECT null,val FROM t; INSERT INTO t SELECT null,val FROM t; INSERT INTO t SELECT null,val FROM t; INSERT INTO t SELECT null,val FROM t; INSERT INTO t SELECT null,val FROM t; INSERT INTO t SELECT null,val FROM t; INSERT INTO t SELECT null,val FROM t; INSERT INTO t SELECT null,val FROM t; INSERT INTO t SELECT null,val FROM t; INSERT INTO t SELECT null,val FROM t; INSERT INTO t SELECT null,val FROM t; SELECT count(*) FROM t; set tokudb_bulk_fetch=ON; let $s = `select unix_timestamp()`; let $i = 0; while ($i < $maxq) { SELECT count(*) from t; inc $i; } let $time_bf_on = `select unix_timestamp() - $s`; if ($debug) { echo index scans took $time_bf_on; } set tokudb_bulk_fetch=OFF; let $s = `select unix_timestamp()`; let $i = 0; while ($i < $maxq) { SELECT count(*) from t; inc $i; } let $time_bf_off = `select unix_timestamp() - $s`; if ($debug) { echo index scans took $time_bf_off.; } # check that the scan time with bulk fetch off is greater than with bulk fetch on let $verdict = `select $time_bf_on > 0 && $time_bf_off > $time_bf_on`; echo $verdict; 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()`; let $i = 0; while ($i < $maxq) { SELECT count(*) from t where num > 500000; inc $i; } let $time_bf_on = `select unix_timestamp() - $s`; if ($debug) { echo range scans took $time_bf_on; } set tokudb_bulk_fetch=OFF; let $s = `select unix_timestamp()`; let $i = 0; while ($i < $maxq) { SELECT count(*) from t where num > 500000; inc $i; } let $time_bf_off = `select unix_timestamp() - $s`; if ($debug) { echo range scans took $time_bf_off.; } # check that the scan time with bulk fetch off is greater than with bulk fetch on let $verdict = `select $time_bf_on > 0 && $time_bf_off > $time_bf_on`; echo $verdict; if ($debug) { echo range $verdict $time_bf_on $time_bf_off; } if (!$verdict) { echo range $time_bf_on $time_bf_off; } drop table t;