summaryrefslogtreecommitdiff
path: root/sql-bench/test-select.sh
diff options
context:
space:
mode:
authormonty@donna.mysql.fi <>2001-03-11 21:20:15 +0200
committermonty@donna.mysql.fi <>2001-03-11 21:20:15 +0200
commit5985de2db5afce4951b4bcf74630e8c746f241b1 (patch)
tree3ffab1dce3f9b12f0d98de2289a2022d1e7f3327 /sql-bench/test-select.sh
parentc1402e2d5c606bfb5e35542ff92ba8e53cb797ab (diff)
downloadmariadb-git-5985de2db5afce4951b4bcf74630e8c746f241b1.tar.gz
Added new tests to benchmark suite
Diffstat (limited to 'sql-bench/test-select.sh')
-rw-r--r--sql-bench/test-select.sh60
1 files changed, 59 insertions, 1 deletions
diff --git a/sql-bench/test-select.sh b/sql-bench/test-select.sh
index e75ee26fff8..3c7efe3c5c2 100644
--- a/sql-bench/test-select.sh
+++ b/sql-bench/test-select.sh
@@ -130,6 +130,37 @@ if ($opt_lock_tables)
select_test:
+if ($limits->{'group_functions'})
+{
+ my ($tmp); $tmp=1000;
+ print "Test if the database has a query cache\n";
+
+ # First ensure that the table is read into memory
+ fetch_all_rows($dbh,"select sum(idn+$tmp),sum(rev_idn+$tmp) from bench1");
+
+ $loop_time=new Benchmark;
+ for ($tests=0 ; $tests < $opt_loop_count ; $tests++)
+ {
+ fetch_all_rows($dbh,"select sum(idn+$tests),sum(rev_idn+$tests) from bench1");
+ }
+ $end_time=new Benchmark;
+ print "Time for select_query_cache ($opt_loop_count): " .
+ timestr(timediff($end_time, $loop_time),"all") . "\n\n";
+
+ # If the database has a query cache, the following loop should be much
+ # slower than the previous loop
+
+ $loop_time=new Benchmark;
+ for ($tests=0 ; $tests < $opt_loop_count ; $tests++)
+ {
+ fetch_all_rows($dbh,"select sum(idn+$tests),sum(rev_idn+$tests) from bench1");
+ }
+ $end_time=new Benchmark;
+ print "Time for select_query_cache2 ($opt_loop_count): " .
+ timestr(timediff($end_time, $loop_time),"all") . "\n\n";
+}
+
+
print "Testing big selects on the table\n";
$loop_time=new Benchmark;
$rows=0;
@@ -288,8 +319,21 @@ if ($limits->{'group_distinct_functions'})
$rows=$estimated=$count=0;
for ($i=0 ; $i < $opt_medium_loop_count ; $i++)
{
- $count+=2;
+ $count++;
$rows+=fetch_all_rows($dbh,"select count(distinct region) from bench1");
+ $end_time=new Benchmark;
+ last if ($estimated=predict_query_time($loop_time,$end_time,\$count,$i+1,
+ $opt_medium_loop_count));
+ }
+ print_time($estimated);
+ print " for count_distinct_key_prefix ($count:$rows): " .
+ timestr(timediff($end_time, $loop_time),"all") . "\n";
+
+ $loop_time=new Benchmark;
+ $rows=$estimated=$count=0;
+ for ($i=0 ; $i < $opt_medium_loop_count ; $i++)
+ {
+ $count++;
$rows+=fetch_all_rows($dbh,"select count(distinct grp) from bench1");
$end_time=new Benchmark;
last if ($estimated=predict_query_time($loop_time,$end_time,\$count,$i+1,
@@ -304,6 +348,20 @@ if ($limits->{'group_distinct_functions'})
for ($i=0 ; $i < $opt_medium_loop_count ; $i++)
{
$count++;
+ $rows+=fetch_all_rows($dbh,"select count(distinct grp),count(distinct rev_idn) from bench1");
+ $end_time=new Benchmark;
+ last if ($estimated=predict_query_time($loop_time,$end_time,\$count,$i+1,
+ $opt_medium_loop_count));
+ }
+ print_time($estimated);
+ print " for count_distinct_2 ($count:$rows): " .
+ timestr(timediff($end_time, $loop_time),"all") . "\n";
+
+ $loop_time=new Benchmark;
+ $rows=$estimated=$count=0;
+ for ($i=0 ; $i < $opt_medium_loop_count ; $i++)
+ {
+ $count++;
$rows+=fetch_all_rows($dbh,"select region,count(distinct idn) from bench1 group by region");
$end_time=new Benchmark;
last if ($estimated=predict_query_time($loop_time,$end_time,\$count,$i+1,