diff options
Diffstat (limited to 'sql-bench')
-rw-r--r-- | sql-bench/compare-results.sh | 2 | ||||
-rw-r--r-- | sql-bench/test-insert.sh | 51 |
2 files changed, 52 insertions, 1 deletions
diff --git a/sql-bench/compare-results.sh b/sql-bench/compare-results.sh index 9e3a8f2add8..e95bd23e6a3 100644 --- a/sql-bench/compare-results.sh +++ b/sql-bench/compare-results.sh @@ -93,7 +93,7 @@ foreach (@ARGV) } elsif (/Comments:\s+(.+)/i) { $tot{$prog}{'comments'} = $1; - } elsif (/^(\S+):\s*(estimated\s|)total\stime:\s+([\d.]+)\s+(wallclock\s|)secs/i) + } elsif (/^(\S+):.*(estimated\s|)total\stime:\s+([\d.]+)\s+(wallclock\s|)secs/i) { $tmp = $1; $tmp =~ s/://; $tot{$prog}{$tmp} = [ $3, (length($2) ? "+" : "")]; diff --git a/sql-bench/test-insert.sh b/sql-bench/test-insert.sh index 8f2d246ff12..f83d0fd13be 100644 --- a/sql-bench/test-insert.sh +++ b/sql-bench/test-insert.sh @@ -283,6 +283,57 @@ if ($limits->{'unique_index'}) select_test: +# ----------------- prepared+executed/prepared*executed tests + +print "Test of prepared+execute/once prepared many execute selects\n"; +$loop_time=new Benchmark; + +for ($i=1 ; $i <= $opt_loop_count ; $i++) +{ + my ($key_value)=$random[$i]; + my ($query)= "select * from bench1 where id=$key_value"; + print "$query\n" if ($opt_debug); + $sth = $dbh->prepare($query); + if (! $sth) + { + die "error in prepare select with id = $key_value : $DBI::errstr"; + }; + if (! $sth->execute) + { + die "cannot execute prepare select with id = $key_value : $DBI::errstr"; + } + while ($sth->fetchrow_arrayref) { }; + $sth->finish; +}; +$end_time=new Benchmark; +print "Time for prepared_select ($opt_loop_count): " . + timestr(timediff($end_time, $loop_time),"all") . "\n"; + +$loop_time=new Benchmark; +$query= "select * from bench1 where id=?"; +$sth = $dbh->prepare($query); +if (! $sth) +{ + die "cannot prepare select: $DBI::errstr"; +}; + +for ($i=1 ; $i <= $opt_loop_count ; $i++) +{ + my ($key_value)=$random[$i]; + $sth->bind_param(1,$key_value); + print "$query , id = $key_value\n" if ($opt_debug); + if (! $sth->execute) + { + die "cannot execute prepare select with id = $key_value : $DBI::errstr"; + } + while ($sth->fetchrow_arrayref) { }; +}; +$sth->finish; +$end_time=new Benchmark; +print "Time for once_prepared_select ($opt_loop_count): " . + timestr(timediff($end_time, $loop_time),"all") . "\n"; + + print "Retrieving data from the table\n"; $loop_time=new Benchmark; $error=0; |