Commit d85b993c authored by Rich Prohaska's avatar Rich Prohaska

DB-504 redo bulk fetch select tests in partitioned tables

parent b73bef23
set default_storage_engine='tokudb';
drop table if exists t,t1,t2,t3;
CREATE TABLE `t` (
`num` int(10) unsigned auto_increment NOT NULL,
`val` varchar(32) DEFAULT NULL,
PRIMARY KEY (`num`)
);
INSERT INTO t values (null,null);
INSERT INTO t SELECT null,null FROM t;
INSERT INTO t SELECT null,null FROM t;
INSERT INTO t SELECT null,null FROM t;
INSERT INTO t SELECT null,null FROM t;
INSERT INTO t SELECT null,null FROM t;
INSERT INTO t SELECT null,null FROM t;
INSERT INTO t SELECT null,null FROM t;
INSERT INTO t SELECT null,null FROM t;
INSERT INTO t SELECT null,null FROM t;
INSERT INTO t SELECT null,null FROM t;
INSERT INTO t SELECT null,null FROM t;
INSERT INTO t SELECT null,null FROM t;
INSERT INTO t SELECT null,null FROM t;
INSERT INTO t SELECT null,null FROM t;
INSERT INTO t SELECT null,null FROM t;
INSERT INTO t SELECT null,null FROM t;
INSERT INTO t SELECT null,null FROM t;
INSERT INTO t SELECT null,null FROM t;
INSERT INTO t SELECT null,null FROM t;
INSERT INTO t SELECT null,null FROM t;
INSERT INTO t SELECT null,null FROM t;
INSERT INTO t SELECT null,null FROM t;
INSERT INTO t SELECT null,null FROM t;
SELECT count(*) FROM t;
count(*)
8388608
CREATE TABLE `t1` (
`num` int(10) unsigned NOT NULL,
`val` varchar(32) DEFAULT NULL,
PRIMARY KEY (`num`)
);
CREATE TABLE `t2` (
`num` int(10) unsigned NOT NULL,
`val` varchar(32) DEFAULT NULL,
PRIMARY KEY (`num`)
)
PARTITION BY HASH (num) PARTITIONS 10;
CREATE TABLE `t3` (
`num` int(10) unsigned NOT NULL,
`val` varchar(32) DEFAULT NULL,
PRIMARY KEY (`num`)
)
PARTITION BY RANGE (num)
(PARTITION p0 VALUES LESS THAN (1000000),
PARTITION p1 VALUES LESS THAN (2000000),
PARTITION p2 VALUES LESS THAN (3000000),
PARTITION p3 VALUES LESS THAN (4000000),
PARTITION p4 VALUES LESS THAN (5000000),
PARTITION p5 VALUES LESS THAN (6000000),
PARTITION p6 VALUES LESS THAN (7000000),
PARTITION p7 VALUES LESS THAN (8000000),
PARTITION px VALUES LESS THAN MAXVALUE);
insert into t1 select * from t;
insert into t2 select * from t;
insert into t3 select * from t;
select count(*) from t1;
count(*)
8388608
select count(*) from t1;
count(*)
8388608
select count(*) from t1;
count(*)
8388608
select count(*) from t1;
count(*)
8388608
select count(*) from t1;
count(*)
8388608
select count(*) from t1;
count(*)
8388608
select count(*) from t1;
count(*)
8388608
select count(*) from t1;
count(*)
8388608
select count(*) from t1;
count(*)
8388608
select count(*) from t1;
count(*)
8388608
select count(*) from t2;
count(*)
8388608
select count(*) from t2;
count(*)
8388608
select count(*) from t2;
count(*)
8388608
select count(*) from t2;
count(*)
8388608
select count(*) from t2;
count(*)
8388608
select count(*) from t2;
count(*)
8388608
select count(*) from t2;
count(*)
8388608
select count(*) from t2;
count(*)
8388608
select count(*) from t2;
count(*)
8388608
select count(*) from t2;
count(*)
8388608
1
select count(*) from t3;
count(*)
8388608
select count(*) from t3;
count(*)
8388608
select count(*) from t3;
count(*)
8388608
select count(*) from t3;
count(*)
8388608
select count(*) from t3;
count(*)
8388608
select count(*) from t3;
count(*)
8388608
select count(*) from t3;
count(*)
8388608
select count(*) from t3;
count(*)
8388608
select count(*) from t3;
count(*)
8388608
select count(*) from t3;
count(*)
8388608
1
select count(*) from t1 where num>7000000;
count(*)
1847274
select count(*) from t1 where num>7000000;
count(*)
1847274
select count(*) from t1 where num>7000000;
count(*)
1847274
select count(*) from t1 where num>7000000;
count(*)
1847274
select count(*) from t1 where num>7000000;
count(*)
1847274
select count(*) from t1 where num>7000000;
count(*)
1847274
select count(*) from t1 where num>7000000;
count(*)
1847274
select count(*) from t1 where num>7000000;
count(*)
1847274
select count(*) from t1 where num>7000000;
count(*)
1847274
select count(*) from t1 where num>7000000;
count(*)
1847274
select count(*) from t2 where num>7000000;
count(*)
1847274
select count(*) from t2 where num>7000000;
count(*)
1847274
select count(*) from t2 where num>7000000;
count(*)
1847274
select count(*) from t2 where num>7000000;
count(*)
1847274
select count(*) from t2 where num>7000000;
count(*)
1847274
select count(*) from t2 where num>7000000;
count(*)
1847274
select count(*) from t2 where num>7000000;
count(*)
1847274
select count(*) from t2 where num>7000000;
count(*)
1847274
select count(*) from t2 where num>7000000;
count(*)
1847274
select count(*) from t2 where num>7000000;
count(*)
1847274
1
select count(*) from t3 where num>7000000;
count(*)
1847274
select count(*) from t3 where num>7000000;
count(*)
1847274
select count(*) from t3 where num>7000000;
count(*)
1847274
select count(*) from t3 where num>7000000;
count(*)
1847274
select count(*) from t3 where num>7000000;
count(*)
1847274
select count(*) from t3 where num>7000000;
count(*)
1847274
select count(*) from t3 where num>7000000;
count(*)
1847274
select count(*) from t3 where num>7000000;
count(*)
1847274
select count(*) from t3 where num>7000000;
count(*)
1847274
select count(*) from t3 where num>7000000;
count(*)
1847274
1
drop table if exists t,t1,t2,t3;
# verify that index scans on parititions are not slow
# due to tokudb bulk fetch not being used
source include/have_tokudb.inc;
source include/have_partition.inc;
source include/big_test.inc;
set default_storage_engine='tokudb';
disable_warnings;
drop table if exists t,t1,t2,t3;
enable_warnings;
let $debug = 0;
let $maxq = 10;
CREATE TABLE `t` (
`num` int(10) unsigned auto_increment NOT NULL,
`val` varchar(32) DEFAULT NULL,
PRIMARY KEY (`num`)
);
# put 8M rows into t
if ($debug) { let $ts = `select now()`; echo "start $ts"; }
INSERT INTO t values (null,null);
INSERT INTO t SELECT null,null FROM t;
INSERT INTO t SELECT null,null FROM t;
INSERT INTO t SELECT null,null FROM t;
INSERT INTO t SELECT null,null FROM t;
INSERT INTO t SELECT null,null FROM t;
INSERT INTO t SELECT null,null FROM t;
INSERT INTO t SELECT null,null FROM t;
INSERT INTO t SELECT null,null FROM t;
INSERT INTO t SELECT null,null FROM t;
INSERT INTO t SELECT null,null FROM t;
INSERT INTO t SELECT null,null FROM t;
INSERT INTO t SELECT null,null FROM t;
INSERT INTO t SELECT null,null FROM t;
INSERT INTO t SELECT null,null FROM t;
INSERT INTO t SELECT null,null FROM t;
INSERT INTO t SELECT null,null FROM t;
INSERT INTO t SELECT null,null FROM t;
INSERT INTO t SELECT null,null FROM t;
INSERT INTO t SELECT null,null FROM t;
INSERT INTO t SELECT null,null FROM t;
INSERT INTO t SELECT null,null FROM t;
INSERT INTO t SELECT null,null FROM t;
INSERT INTO t SELECT null,null FROM t;
if ($debug) { let $ts = `select now()`; echo "select $ts"; }
SELECT count(*) FROM t;
if ($debug) { let $ts = `select now()`; echo "select done $ts"; }
CREATE TABLE `t1` (
`num` int(10) unsigned NOT NULL,
`val` varchar(32) DEFAULT NULL,
PRIMARY KEY (`num`)
);
CREATE TABLE `t2` (
`num` int(10) unsigned NOT NULL,
`val` varchar(32) DEFAULT NULL,
PRIMARY KEY (`num`)
)
PARTITION BY HASH (num) PARTITIONS 10;
CREATE TABLE `t3` (
`num` int(10) unsigned NOT NULL,
`val` varchar(32) DEFAULT NULL,
PRIMARY KEY (`num`)
)
PARTITION BY RANGE (num)
(PARTITION p0 VALUES LESS THAN (1000000),
PARTITION p1 VALUES LESS THAN (2000000),
PARTITION p2 VALUES LESS THAN (3000000),
PARTITION p3 VALUES LESS THAN (4000000),
PARTITION p4 VALUES LESS THAN (5000000),
PARTITION p5 VALUES LESS THAN (6000000),
PARTITION p6 VALUES LESS THAN (7000000),
PARTITION p7 VALUES LESS THAN (8000000),
PARTITION px VALUES LESS THAN MAXVALUE);
if ($debug) { let $ts = `select now()`; echo "insert t1 $ts"; }
insert into t1 select * from t;
if ($debug) { let $ts = `select now()`; echo "insert t2 $ts"; }
insert into t2 select * from t;
if ($debug) { let $ts = `select now()`; echo "insert t3 $ts"; }
insert into t3 select * from t;
if ($debug) { let $ts = `select now()`; echo "select t1 $ts"; }
# verify that full index scans on partitioned tables t2 and t3 are comparable to a non-partitioned table t1
let $s = `select to_seconds(now())`;
let $i = 0;
while ($i < $maxq) {
select count(*) from t1;
inc $i;
}
let $t1 = `select to_seconds(now()) - $s`;
if ($debug) { let $ts = `select now()`; echo "select t2 $ts"; }
let $s = `select to_seconds(now())`;
let $i = 0;
while ($i < $maxq) {
select count(*) from t2;
inc $i;
}
let $t2 = `select to_seconds(now()) - $s`;
let $d = `select abs($t2 - $t1) <= $t1`;
echo $d;
if ($debug) { let $ts = `select now()`; echo "select t3 $ts"; }
let $s = `select to_seconds(now())`;
let $i = 0;
while ($i < $maxq) {
select count(*) from t3;
inc $i;
}
let $t3 = `select to_seconds(now()) - $s`;
let $d = `select abs($t3 - $t1) <= $t1`;
echo $d;
if ($debug) { let $ts = `select now()`; echo "select t1 $ts"; }
let $s = `select to_seconds(now())`;
let $i = 0;
while ($i < $maxq) {
select count(*) from t1 where num>7000000;
inc $i;
}
let $t1 = `select to_seconds(now()) - $s`;
if ($debug) { let $ts = `select now()`; echo "select t2 $ts"; }
let $s = `select to_seconds(now())`;
let $i = 0;
while ($i < $maxq) {
select count(*) from t2 where num>7000000;
inc $i;
}
let $t2 = `select to_seconds(now()) - $s`;
let $d = `select abs($t2 - $t1) <= $t1`;
echo $d;
if ($debug) { let $ts = `select now()`; echo "select t3 $ts"; }
let $s = `select to_seconds(now())`;
let $i = 0;
while ($i < $maxq) {
select count(*) from t3 where num>7000000;
inc $i;
}
let $t3 = `select to_seconds(now()) - $s`;
let $d = `select abs($t3 - $t1) <= $t1`;
echo $d;
if ($debug) { let $ts = `select now()`; echo "done $ts"; }
drop table if exists t,t1,t2,t3;
set default_storage_engine='tokudb';
drop table if exists t;
CREATE TABLE `t` (
`num` int(10) unsigned NOT NULL auto_increment,
`val` varchar(32) DEFAULT NULL,
PRIMARY KEY (`num`)
) PARTITION BY HASH (num) PARTITIONS 8;
INSERT INTO t values (null,null);
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
SELECT count(*) FROM t;
count(*)
1048576
set tokudb_bulk_fetch=ON;
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
set tokudb_bulk_fetch=OFF;
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
1
set tokudb_bulk_fetch=ON;
SELECT count(*) from t where num > 500000;
count(*)
548576
SELECT count(*) from t where num > 500000;
count(*)
548576
SELECT count(*) from t where num > 500000;
count(*)
548576
SELECT count(*) from t where num > 500000;
count(*)
548576
SELECT count(*) from t where num > 500000;
count(*)
548576
SELECT count(*) from t where num > 500000;
count(*)
548576
SELECT count(*) from t where num > 500000;
count(*)
548576
SELECT count(*) from t where num > 500000;
count(*)
548576
SELECT count(*) from t where num > 500000;
count(*)
548576
SELECT count(*) from t where num > 500000;
count(*)
548576
SELECT count(*) from t where num > 500000;
count(*)
548576
SELECT count(*) from t where num > 500000;
count(*)
548576
SELECT count(*) from t where num > 500000;
count(*)
548576
SELECT count(*) from t where num > 500000;
count(*)
548576
SELECT count(*) from t where num > 500000;
count(*)
548576
SELECT count(*) from t where num > 500000;
count(*)
548576
SELECT count(*) from t where num > 500000;
count(*)
548576
SELECT count(*) from t where num > 500000;
count(*)
548576
SELECT count(*) from t where num > 500000;
count(*)
548576
SELECT count(*) from t where num > 500000;
count(*)
548576
set tokudb_bulk_fetch=OFF;
SELECT count(*) from t where num > 500000;
count(*)
548576
SELECT count(*) from t where num > 500000;
count(*)
548576
SELECT count(*) from t where num > 500000;
count(*)
548576
SELECT count(*) from t where num > 500000;
count(*)
548576
SELECT count(*) from t where num > 500000;
count(*)
548576
SELECT count(*) from t where num > 500000;
count(*)
548576
SELECT count(*) from t where num > 500000;
count(*)
548576
SELECT count(*) from t where num > 500000;
count(*)
548576
SELECT count(*) from t where num > 500000;
count(*)
548576
SELECT count(*) from t where num > 500000;
count(*)
548576
SELECT count(*) from t where num > 500000;
count(*)
548576
SELECT count(*) from t where num > 500000;
count(*)
548576
SELECT count(*) from t where num > 500000;
count(*)
548576
SELECT count(*) from t where num > 500000;
count(*)
548576
SELECT count(*) from t where num > 500000;
count(*)
548576
SELECT count(*) from t where num > 500000;
count(*)
548576
SELECT count(*) from t where num > 500000;
count(*)
548576
SELECT count(*) from t where num > 500000;
count(*)
548576
SELECT count(*) from t where num > 500000;
count(*)
548576
SELECT count(*) from t where num > 500000;
count(*)
548576
1
drop table t;
This diff is collapsed.
set default_storage_engine='tokudb';
drop table if exists t;
CREATE TABLE `t` (
`num` int(10) unsigned NOT NULL auto_increment,
`val` varchar(32) DEFAULT NULL,
PRIMARY KEY (`num`)
) PARTITION BY RANGE (num)
(PARTITION p0 VALUES LESS THAN (100000),
PARTITION p1 VALUES LESS THAN (200000),
PARTITION p2 VALUES LESS THAN (300000),
PARTITION p3 VALUES LESS THAN (400000),
PARTITION p4 VALUES LESS THAN (500000),
PARTITION p5 VALUES LESS THAN (600000),
PARTITION p6 VALUES LESS THAN (700000),
PARTITION p7 VALUES LESS THAN MAXVALUE);
INSERT INTO t values (null,null);
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
SELECT count(*) FROM t;
count(*)
1048576
set tokudb_bulk_fetch=ON;
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
set tokudb_bulk_fetch=OFF;
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
SELECT count(*) from t;
count(*)
1048576
1
set tokudb_bulk_fetch=ON;
SELECT count(*) from t where num > 700000;
count(*)
348576
SELECT count(*) from t where num > 700000;
count(*)
348576
SELECT count(*) from t where num > 700000;
count(*)
348576
SELECT count(*) from t where num > 700000;
count(*)
348576
SELECT count(*) from t where num > 700000;
count(*)
348576
SELECT count(*) from t where num > 700000;
count(*)
348576
SELECT count(*) from t where num > 700000;
count(*)
348576
SELECT count(*) from t where num > 700000;
count(*)
348576
SELECT count(*) from t where num > 700000;
count(*)
348576
SELECT count(*) from t where num > 700000;
count(*)
348576
SELECT count(*) from t where num > 700000;
count(*)
348576
SELECT count(*) from t where num > 700000;
count(*)
348576
SELECT count(*) from t where num > 700000;
count(*)
348576
SELECT count(*) from t where num > 700000;
count(*)
348576
SELECT count(*) from t where num > 700000;
count(*)
348576
SELECT count(*) from t where num > 700000;
count(*)
348576
SELECT count(*) from t where num > 700000;
count(*)
348576
SELECT count(*) from t where num > 700000;
count(*)
348576
SELECT count(*) from t where num > 700000;
count(*)
348576
SELECT count(*) from t where num > 700000;
count(*)
348576
set tokudb_bulk_fetch=OFF;
SELECT count(*) from t where num > 700000;
count(*)
348576
SELECT count(*) from t where num > 700000;
count(*)
348576
SELECT count(*) from t where num > 700000;
count(*)
348576
SELECT count(*) from t where num > 700000;
count(*)
348576
SELECT count(*) from t where num > 700000;
count(*)
348576
SELECT count(*) from t where num > 700000;
count(*)
348576
SELECT count(*) from t where num > 700000;
count(*)
348576
SELECT count(*) from t where num > 700000;
count(*)
348576
SELECT count(*) from t where num > 700000;
count(*)
348576
SELECT count(*) from t where num > 700000;
count(*)
348576
SELECT count(*) from t where num > 700000;
count(*)
348576
SELECT count(*) from t where num > 700000;
count(*)
348576
SELECT count(*) from t where num > 700000;
count(*)
348576
SELECT count(*) from t where num > 700000;
count(*)
348576
SELECT count(*) from t where num > 700000;
count(*)
348576
SELECT count(*) from t where num > 700000;
count(*)
348576
SELECT count(*) from t where num > 700000;
count(*)
348576
SELECT count(*) from t where num > 700000;
count(*)
348576
SELECT count(*) from t where num > 700000;
count(*)
348576
SELECT count(*) from t where num > 700000;
count(*)
348576
1
drop table t;
# Verify that index and range scans on a hash partitioned tokudb table are not slow on tables
# due to tokudb bulk fetch not being used.
source include/have_tokudb.inc;
source include/have_partition.inc;
source include/big_test.inc;
set default_storage_engine='tokudb';
disable_warnings;
drop table if exists t;
enable_warnings;
let $maxq = 20;
let $debug = 0;
# create the hash partition table
CREATE TABLE `t` (
`num` int(10) unsigned NOT NULL auto_increment,
`val` varchar(32) DEFAULT NULL,
PRIMARY KEY (`num`)
) PARTITION BY HASH (num) PARTITIONS 8;
# put 1M rows into t
INSERT INTO t values (null,null);
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
SELECT count(*) FROM t;
set tokudb_bulk_fetch=ON;
let $s = `select unix_timestamp()`;
let $i = 0;
while ($i < $maxq) {
SELECT count(*) from t;
inc $i;
}
let $time_bf_on = `select unix_timestamp() - $s`;
if ($debug) { echo index scans took $time_bf_on; }
set tokudb_bulk_fetch=OFF;
let $s = `select unix_timestamp()`;
let $i = 0;
while ($i < $maxq) {
SELECT count(*) from t;
inc $i;
}
let $time_bf_off = `select unix_timestamp() - $s`;
if ($debug) { echo index scans took $time_bf_off.; }
# check that the scan time with bulk fetch off is at least 1.5 times as long as with bulk fetch on
let $verdict = `select $time_bf_off > $time_bf_on && $time_bf_off >= 1.5 * $time_bf_on`;
echo $verdict;
if (!$verdict) { echo index scan $time_bf_on $time_bf_off; }
set tokudb_bulk_fetch=ON;
let $s = `select unix_timestamp()`;
let $i = 0;
while ($i < $maxq) {
SELECT count(*) from t where num > 500000;
inc $i;
}
let $time_bf_on = `select unix_timestamp() - $s`;
if ($debug) { echo range scans took $time_bf_on; }
set tokudb_bulk_fetch=OFF;
let $s = `select unix_timestamp()`;
let $i = 0;
while ($i < $maxq) {
SELECT count(*) from t where num > 500000;
inc $i;
}
let $time_bf_off = `select unix_timestamp() - $s`;
if ($debug) { echo range scans took $time_bf_off.; }
# check that the scan time with bulk fetch off is at least 1.5 times as long as with bulk fetch on
let $verdict = `select $time_bf_off > $time_bf_on && $time_bf_off >= 1.5 * $time_bf_on`;
echo $verdict;
if (!$verdict) { echo range scan $time_bf_on $time_bf_off; }
drop table t;
# Verify that index and range scans are not slow
# on tables during create select statements
# against hash and range partitioned tables
# due to tokudb bulk fetch not being used
source include/have_tokudb.inc;
source include/have_partition.inc;
source include/big_test.inc;
set default_storage_engine='tokudb';
disable_warnings;
drop table if exists t,t1,t2,t3;
enable_warnings;
let $maxq = 10;
CREATE TABLE `t` (
`num` int(10) unsigned auto_increment NOT NULL,
`val` varchar(32) DEFAULT NULL,
PRIMARY KEY (`num`)
);
# put 8M rows into t
INSERT INTO t values (null,null);
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
SELECT count(*) FROM t;
# Create first table from source table t
CREATE TABLE `t1` (
`num` int(10) unsigned NOT NULL,
`val` varchar(32) DEFAULT NULL,
PRIMARY KEY (`num`)
) as select * from t;
# Create second table from source table t
CREATE TABLE `t2` (
`num` int(10) unsigned NOT NULL,
`val` varchar(32) DEFAULT NULL,
PRIMARY KEY (`num`)
) PARTITION BY HASH (num)
PARTITIONS 8 as select * from t;
# Create third table from source table t;
CREATE TABLE `t3` (
`num` int(10) unsigned NOT NULL,
`val` varchar(32) DEFAULT NULL,
PRIMARY KEY (`num`)
) PARTITION BY RANGE (num)
(PARTITION p0 VALUES LESS THAN (1000000),
PARTITION p1 VALUES LESS THAN (2000000),
PARTITION p2 VALUES LESS THAN (3000000),
PARTITION p3 VALUES LESS THAN (4000000),
PARTITION p4 VALUES LESS THAN (5000000),
PARTITION p5 VALUES LESS THAN (6000000),
PARTITION p6 VALUES LESS THAN (7000000),
PARTITION p7 VALUES LESS THAN MAXVALUE) as select * from t;
let $s = `select to_seconds(now())`;
let $i = 0;
while ($i < $maxq) {
SELECT count(*) from t1;
inc $i;
}
let $time_elapsed_select = `select to_seconds(now()) - $s`;
# The following line can be used to display the time elapsed data
# which could be useful for debugging.
# echo Index scans took $time_elapsed_select seconds.;
let $s = `select to_seconds(now())`;
let $i = 0;
while ($i < $maxq) {
SELECT count(*) from t2;
inc $i;
}
let $time_elapsed_select_hash = `select to_seconds(now()) - $s`;
# The following line can be used to display the time elapsed data
# which could be useful for debugging.
# echo Index scans took $time_elapsed_select_hash seconds.;
# This check evaluates whether the time elapsed during the select statement
# against a hashed partition table is on par with the select statment
# against a non-partitioned table, which will confirm that bulk fetch is in fact being used.
let $verdict = `select abs($time_elapsed_select_hash - $time_elapsed_select) <= $time_elapsed_select`;
echo $verdict;
if (!$verdict) { echo index scan t2 $time_elapsed_select_hash $time_elapsed_select; }
######################################################################
let $s = `select to_seconds(now())`;
let $i = 0;
while ($i < $maxq) {
SELECT count(*) from t1;
inc $i;
}
let $time_elapsed_select = `select to_seconds(now()) - $s`;
# The following line can be used to display the time elapsed data
# which could be useful for debugging.
#echo Index scans took $time_elapsed_select seconds.;
let $s = `select to_seconds(now())`;
let $i = 0;
while ($i < $maxq) {
SELECT count(*) from t3;
inc $i;
}
let $time_elapsed_select_range = `select to_seconds(now()) - $s`;
# The following line can be used to display the time elapsed data
# which could be useful for debugging.
#echo Index scans took $time_elapsed_select_range seconds.;
# This check evaluates whether the time elapsed during the select statement
# against a range partition table is on par with the select statment
# against a non-partitioned table, which will confirm that bulk fetch is in fact being used.
let $verdict = `select abs($time_elapsed_select_range - $time_elapsed_select) <= $time_elapsed_select`;
echo $verdict;
if (!$verdict) { echo index scan t3 $time_elapsed_select_range $time_elapsed_select; }
#########################################################################
let $maxrq = 30;
let $s = `select to_seconds(now())`;
let $i = 0;
while ($i < $maxrq) {
SELECT count(*) from t1 where num > 7000000;
inc $i;
}
let $time_elapsed_select = `select to_seconds(now()) - $s`;
# The following line can be used to display the time elapsed data
# which could be useful for debugging.
#echo Index scans took $time_elapsed_select seconds.;
let $s = `select to_seconds(now())`;
let $i = 0;
while ($i < $maxrq) {
SELECT count(*) from t2 where num > 7000000;
inc $i;
}
let $time_elapsed_select_hash = `select to_seconds(now()) - $s`;
# The following line can be used to display the time elapsed data
# which could be useful for debugging.
#echo Index scans took $time_elapsed_select_hash seconds.;
# This check evaluates whether the time elapsed during the select statement
# against a hash partition table is on par with the select statment
# against a non-partitioned table, which will confirm that bulk fetch is in fact being used.
let $verdict = `select abs($time_elapsed_select_hash - $time_elapsed_select) <= $time_elapsed_select`;
echo $verdict;
if (!$verdict) { echo range scan t2 $time_elapsed_select_hash $time_elapsed_select; }
#########################################################################
let $maxrq = 30;
let $s = `select to_seconds(now())`;
let $i = 0;
while ($i < $maxrq) {
SELECT count(*) from t1 where num > 7000000;
inc $i;
}
let $time_elapsed_select = `select to_seconds(now()) - $s`;
# The following line can be used to display the time elapsed data
# which could be useful for debugging.
#echo Index scans took $time_elapsed_select seconds.;
let $s = `select to_seconds(now())`;
let $i = 0;
while ($i < $maxrq) {
SELECT count(*) from t3 where num > 7000000;
inc $i;
}
let $time_elapsed_select_range = `select to_seconds(now()) - $s`;
# The following line can be used to display the time elapsed data
# which could be useful for debugging.
#echo Index scans took $time_elapsed_select_range seconds.;
# This check evaluates whether the time elapsed during the select statement
# against a range partition table is on par with the select statment
# against a non-partitioned table, which will confirm that bulk fetch is in fact being used.
let $verdict = `select abs($time_elapsed_select_range - $time_elapsed_select) <= $time_elapsed_select`;
echo $verdict;
if (!$verdict) { echo range scan t3 $time_elapsed_select_range $time_elapsed_select; }
drop table t,t1,t2,t3;
# Verify that index and range scans on a range partitioned tokudb table are not slow on tables
# due to tokudb bulk fetch not being used.
source include/have_tokudb.inc;
source include/have_partition.inc;
source include/big_test.inc;
set default_storage_engine='tokudb';
disable_warnings;
drop table if exists t;
enable_warnings;
let $maxq = 20;
let $debug = 0;
# create the range partition table
CREATE TABLE `t` (
`num` int(10) unsigned NOT NULL auto_increment,
`val` varchar(32) DEFAULT NULL,
PRIMARY KEY (`num`)
) PARTITION BY RANGE (num)
(PARTITION p0 VALUES LESS THAN (100000),
PARTITION p1 VALUES LESS THAN (200000),
PARTITION p2 VALUES LESS THAN (300000),
PARTITION p3 VALUES LESS THAN (400000),
PARTITION p4 VALUES LESS THAN (500000),
PARTITION p5 VALUES LESS THAN (600000),
PARTITION p6 VALUES LESS THAN (700000),
PARTITION p7 VALUES LESS THAN MAXVALUE);
# put 1M rows into t
INSERT INTO t values (null,null);
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
INSERT INTO t SELECT null,val FROM t;
SELECT count(*) FROM t;
set tokudb_bulk_fetch=ON;
let $s = `select unix_timestamp()`;
let $i = 0;
while ($i < $maxq) {
SELECT count(*) from t;
inc $i;
}
let $time_bf_on = `select unix_timestamp() - $s`;
if ($debug) { echo index scans took $time_bf_on; }
set tokudb_bulk_fetch=OFF;
let $s = `select unix_timestamp()`;
let $i = 0;
while ($i < $maxq) {
SELECT count(*) from t;
inc $i;
}
let $time_bf_off = `select unix_timestamp() - $s`;
if ($debug) { echo index scans took $time_bf_off.; }
# check that the scan time with bulk fetch off is at least 1.5 times as long as with bulk fetch on
let $verdict = `select $time_bf_off > $time_bf_on && $time_bf_off >= 1.5 * $time_bf_on`;
echo $verdict;
if (!$verdict) { echo index scan $time_bf_on $time_bf_off; }
set tokudb_bulk_fetch=ON;
let $s = `select unix_timestamp()`;
let $i = 0;
while ($i < $maxq) {
SELECT count(*) from t where num > 700000;
inc $i;
}
let $time_bf_on = `select unix_timestamp() - $s`;
if ($debug) { echo range scans took $time_bf_on; }
set tokudb_bulk_fetch=OFF;
let $s = `select unix_timestamp()`;
let $i = 0;
while ($i < $maxq) {
SELECT count(*) from t where num > 700000;
inc $i;
}
let $time_bf_off = `select unix_timestamp() - $s`;
if ($debug) { echo range scans took $time_bf_off.; }
# check that the scan time with bulk fetch off is at least 1.5 times as long as with bulk fetch on
let $verdict = `select $time_bf_off > $time_bf_on && $time_bf_off >= 1.5 * $time_bf_on`;
echo $verdict;
if (!$verdict) { echo range scan $time_bf_on $time_bf_off; }
drop table t;
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment