summaryrefslogtreecommitdiff
path: root/sql-bench
diff options
context:
space:
mode:
Diffstat (limited to 'sql-bench')
-rwxr-xr-xsql-bench/bench-init.pl.sh9
-rwxr-xr-xsql-bench/crash-me.sh7
-rwxr-xr-xsql-bench/test-insert.sh8
-rwxr-xr-xsql-bench/test-select.sh65
4 files changed, 59 insertions, 30 deletions
diff --git a/sql-bench/bench-init.pl.sh b/sql-bench/bench-init.pl.sh
index 3f650885c21..ae847c1a28f 100755
--- a/sql-bench/bench-init.pl.sh
+++ b/sql-bench/bench-init.pl.sh
@@ -339,6 +339,15 @@ sub end_benchmark
exit 0;
}
+sub print_time
+{
+ my ($estimated)=@_;
+ if ($estimated)
+ { print "Estimated time"; }
+ else
+ { print "Time"; }
+}
+
#
# Create a filename part for the machine that can be used for log file.
#
diff --git a/sql-bench/crash-me.sh b/sql-bench/crash-me.sh
index 6bb3eab63f9..5c993e842bc 100755
--- a/sql-bench/crash-me.sh
+++ b/sql-bench/crash-me.sh
@@ -39,7 +39,7 @@
# "3-byte int" or "same as xxx".
-$version="1.50";
+$version="1.51";
use DBI;
use Getopt::Long;
@@ -289,6 +289,11 @@ report("rename table","rename_table",
$dbh->do("drop table crash_q1");
$dbh->do("drop table crash_q");
+report("truncate table","truncate_table",
+ "create table crash_q (a integer, b integer,c CHAR(10))",
+ "truncate table crash_q",
+ "drop table crash_q1");
+
if ($dbh->do("create table crash_q (a integer, b integer,c CHAR(10))") &&
$dbh->do("create table crash_q1 (a integer, b integer,c CHAR(10) not null)"))
{
diff --git a/sql-bench/test-insert.sh b/sql-bench/test-insert.sh
index 36a2b7761d5..13bcfb2f6a9 100755
--- a/sql-bench/test-insert.sh
+++ b/sql-bench/test-insert.sh
@@ -498,6 +498,7 @@ if ($limits->{'group_functions'})
$loop_time=new Benchmark;
$count=1;
+ $estimated=0;
for ($tests=0 ; $tests < $small_loop_count ; $tests++)
{
$sth=$dbh->prepare($query="select count(*) from bench1") or die $DBI::errstr;
@@ -573,9 +574,12 @@ if ($limits->{'group_functions'})
print "Warning: '$query' returned wrong number of rows\n";
}
}
+ $end_time=new Benchmark;
+ last if ($estimated=predict_query_time($loop_time,$end_time,\$count,$tests,
+ $small_loop_count));
}
- $end_time=new Benchmark;
- print "Time for select_group ($count): " .
+ print_time($estimated);
+ print " for select_group ($count): " .
timestr(timediff($end_time, $loop_time),"all") . "\n";
$loop_time=new Benchmark;
diff --git a/sql-bench/test-select.sh b/sql-bench/test-select.sh
index 10b36e4be60..32059d6ac8a 100755
--- a/sql-bench/test-select.sh
+++ b/sql-bench/test-select.sh
@@ -205,10 +205,7 @@ for ($i=0 ; $i < $opt_small_loop_count ; $i++)
$opt_small_loop_count));
}
-if ($estimated)
-{ print "Estimated time"; }
-else
-{ print "Time"; }
+print_time($estimated);
print " for select_range ($count:$rows): " .
timestr(timediff($end_time, $loop_time),"all") . "\n";
@@ -243,10 +240,7 @@ if ($limits->{'group_functions'})
last if ($estimated=predict_query_time($loop_time,$end_time,\$count,
$tests+1, $opt_loop_count));
}
- if ($estimated)
- { print "Estimated time"; }
- else
- { print "Time"; }
+ print_time($estimated);
print " for min_max_on_key ($count): " .
timestr(timediff($end_time, $loop_time),"all") . "\n";
@@ -267,10 +261,7 @@ if ($limits->{'group_functions'})
last if ($estimated=predict_query_time($loop_time,$end_time,\$count,
$tests+1, $opt_loop_count));
}
- if ($estimated)
- { print "Estimated time"; }
- else
- { print "Time"; }
+ print_time($estimated);
print " for count_on_key ($count): " .
timestr(timediff($end_time, $loop_time),"all") . "\n\n";
@@ -289,54 +280,74 @@ if ($limits->{'group_functions'})
{
print "Testing count(distinct) on the table\n";
$loop_time=new Benchmark;
- $rows=0;
+ $rows=$estimated=$count=0;
for ($i=0 ; $i < $opt_medium_loop_count ; $i++)
{
+ $count+=2;
$rows+=fetch_all_rows($dbh,"select count(distinct region) from bench1");
$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,
+ $opt_medium_loop_count));
}
- $end_time=new Benchmark;
- print "Time for count_distinct ($i:$rows): " .
+ print_time($estimated);
+ print " for count_distinct ($count:$rows): " .
timestr(timediff($end_time, $loop_time),"all") . "\n";
$loop_time=new Benchmark;
- $rows=0;
+ $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,
+ $opt_medium_loop_count));
}
- $end_time=new Benchmark;
- print "Time for count_distinct_group_on_key ($i:$rows): " .
+ print_time($estimated);
+ print " for count_distinct_group_on_key ($count:$rows): " .
timestr(timediff($end_time, $loop_time),"all") . "\n";
$loop_time=new Benchmark;
- $rows=0;
+ $rows=$estimated=$count=0;
for ($i=0 ; $i < $opt_medium_loop_count ; $i++)
{
+ $count++;
$rows+=fetch_all_rows($dbh,"select grp,count(distinct idn) from bench1 group by grp");
+ $end_time=new Benchmark;
+ last if ($estimated=predict_query_time($loop_time,$end_time,\$count,$i+1,
+ $opt_medium_loop_count));
}
- $end_time=new Benchmark;
- print "Time for count_distinct_group_on_key_parts ($i:$rows): " .
+ print_time($estimated);
+ print " for count_distinct_group_on_key_parts ($count:$rows): " .
timestr(timediff($end_time, $loop_time),"all") . "\n";
$loop_time=new Benchmark;
- $rows=0;
+ $rows=$estimated=$count=0;
for ($i=0 ; $i < $opt_medium_loop_count ; $i++)
{
+ $count++;
$rows+=fetch_all_rows($dbh,"select grp,count(distinct rev_idn) from bench1 group by grp");
+ $end_time=new Benchmark;
+ last if ($estimated=predict_query_time($loop_time,$end_time,\$count,$i+1,
+ $opt_medium_loop_count));
}
- $end_time=new Benchmark;
- print "Time for count_distinct_group ($i:$rows): " .
+ print_time($estimated);
+ print " for count_distinct_group ($count:$rows): " .
timestr(timediff($end_time, $loop_time),"all") . "\n";
$loop_time=new Benchmark;
- $rows=0;
+ $rows=$estimated=$count=0;
for ($i=0 ; $i < $opt_medium_loop_count ; $i++)
{
+ $count++;
$rows+=fetch_all_rows($dbh,"select idn,count(distinct region) from bench1 group by idn");
+ $end_time=new Benchmark;
+ last if ($estimated=predict_query_time($loop_time,$end_time,\$count,$i+1,
+ $opt_medium_loop_count));
}
- $end_time=new Benchmark;
- print "Time for count_distinct_big ($i:$rows): " .
+ print_time($estimated);
+ print " for count_distinct_big ($count:$rows): " .
timestr(timediff($end_time, $loop_time),"all") . "\n";
}