Commit f17d5c17 authored by Rich Prohaska's avatar Rich Prohaska

#261 run multiple queries in part_index_scan

parent 3d4e10ee
...@@ -64,6 +64,60 @@ insert into t3 select * from t; ...@@ -64,6 +64,60 @@ insert into t3 select * from t;
select count(*) from t1; select count(*) from t1;
count(*) count(*)
8388608 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; select count(*) from t2;
count(*) count(*)
8388608 8388608
...@@ -71,10 +125,91 @@ count(*) ...@@ -71,10 +125,91 @@ count(*)
select count(*) from t3; select count(*) from t3;
count(*) count(*)
8388608 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 1
select count(*) from t1 where num>7000000; select count(*) from t1 where num>7000000;
count(*) count(*)
1847274 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; select count(*) from t2 where num>7000000;
count(*) count(*)
1847274 1847274
...@@ -82,5 +217,32 @@ count(*) ...@@ -82,5 +217,32 @@ count(*)
select count(*) from t3 where num>7000000; select count(*) from t3 where num>7000000;
count(*) count(*)
1847274 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 1
drop table if exists t,t1,t2,t3; drop table if exists t,t1,t2,t3;
# verify that index scans on parititions are not slow # verify that index scans on parititions are not slow
# due totokudb bulk fetch not being used # due to tokudb bulk fetch not being used
source include/have_tokudb.inc; source include/have_tokudb.inc;
source include/have_partition.inc;
set default_storage_engine='tokudb'; set default_storage_engine='tokudb';
disable_warnings; disable_warnings;
drop table if exists t,t1,t2,t3; drop table if exists t,t1,t2,t3;
enable_warnings;
let $debug = 0;
let $maxq = 10;
CREATE TABLE `t` ( CREATE TABLE `t` (
`num` int(10) unsigned auto_increment NOT NULL, `num` int(10) unsigned auto_increment NOT NULL,
...@@ -13,6 +16,7 @@ CREATE TABLE `t` ( ...@@ -13,6 +16,7 @@ CREATE TABLE `t` (
); );
# put 8M rows into t # put 8M rows into t
if ($debug) { let $ts = `select now()`; echo "start $ts"; }
INSERT INTO t values (null,null); 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;
...@@ -37,7 +41,9 @@ INSERT INTO t SELECT null,null FROM t; ...@@ -37,7 +41,9 @@ 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; SELECT count(*) FROM t;
if ($debug) { let $ts = `select now()`; echo "select done $ts"; }
CREATE TABLE `t1` ( CREATE TABLE `t1` (
`num` int(10) unsigned NOT NULL, `num` int(10) unsigned NOT NULL,
...@@ -68,48 +74,81 @@ PARTITION BY RANGE (num) ...@@ -68,48 +74,81 @@ PARTITION BY RANGE (num)
PARTITION p7 VALUES LESS THAN (8000000), PARTITION p7 VALUES LESS THAN (8000000),
PARTITION px VALUES LESS THAN MAXVALUE); PARTITION px VALUES LESS THAN MAXVALUE);
if ($debug) { let $ts = `select now()`; echo "insert t1 $ts"; }
insert into t1 select * from t; insert into t1 select * from t;
if ($debug) { let $ts = `select now()`; echo "insert t2 $ts"; }
insert into t2 select * from t; insert into t2 select * from t;
if ($debug) { let $ts = `select now()`; echo "insert t3 $ts"; }
insert into t3 select * from t; 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 # 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 $s = `select to_seconds(now())`;
select count(*) from t1; let $i = 0;
while ($i < $maxq) {
select count(*) from t1;
inc $i;
}
let $t1 = `select to_seconds(now()) - $s`; let $t1 = `select to_seconds(now()) - $s`;
# echo $t1;
if ($debug) { let $ts = `select now()`; echo "select t2 $ts"; }
let $s = `select to_seconds(now())`; let $s = `select to_seconds(now())`;
select count(*) from t2; let $i = 0;
while ($i < $maxq) {
select count(*) from t2;
inc $i;
}
let $t2 = `select to_seconds(now()) - $s`; let $t2 = `select to_seconds(now()) - $s`;
# echo $t2;
let $d = `select abs($t2 - $t1) <= $t1`; let $d = `select abs($t2 - $t1) <= $t1`;
echo $d; echo $d;
if ($debug) { let $ts = `select now()`; echo "select t3 $ts"; }
let $s = `select to_seconds(now())`; let $s = `select to_seconds(now())`;
select count(*) from t3; let $i = 0;
while ($i < $maxq) {
select count(*) from t3;
inc $i;
}
let $t3 = `select to_seconds(now()) - $s`; let $t3 = `select to_seconds(now()) - $s`;
# echo $t3;
let $d = `select abs($t3 - $t1) <= $t1`; let $d = `select abs($t3 - $t1) <= $t1`;
echo $d; echo $d;
if ($debug) { let $ts = `select now()`; echo "select t1 $ts"; }
let $s = `select to_seconds(now())`; let $s = `select to_seconds(now())`;
select count(*) from t1 where num>7000000; let $i = 0;
while ($i < $maxq) {
select count(*) from t1 where num>7000000;
inc $i;
}
let $t1 = `select to_seconds(now()) - $s`; let $t1 = `select to_seconds(now()) - $s`;
# echo $t1;
if ($debug) { let $ts = `select now()`; echo "select t2 $ts"; }
let $s = `select to_seconds(now())`; let $s = `select to_seconds(now())`;
select count(*) from t2 where num>7000000; let $i = 0;
while ($i < $maxq) {
select count(*) from t2 where num>7000000;
inc $i;
}
let $t2 = `select to_seconds(now()) - $s`; let $t2 = `select to_seconds(now()) - $s`;
# echo $t2;
let $d = `select abs($t2 - $t1) <= $t1`; let $d = `select abs($t2 - $t1) <= $t1`;
echo $d; echo $d;
if ($debug) { let $ts = `select now()`; echo "select t3 $ts"; }
let $s = `select to_seconds(now())`; let $s = `select to_seconds(now())`;
select count(*) from t3 where num>7000000; let $i = 0;
while ($i < $maxq) {
select count(*) from t3 where num>7000000;
inc $i;
}
let $t3 = `select to_seconds(now()) - $s`; let $t3 = `select to_seconds(now()) - $s`;
# echo $t3;
let $d = `select abs($t3 - $t1) <= $t1`; let $d = `select abs($t3 - $t1) <= $t1`;
echo $d; echo $d;
enable_warnings; if ($debug) { let $ts = `select now()`; echo "done $ts"; }
drop table if exists t,t1,t2,t3; drop table if exists t,t1,t2,t3;
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