summaryrefslogtreecommitdiff
path: root/sql-bench
diff options
context:
space:
mode:
Diffstat (limited to 'sql-bench')
-rw-r--r--sql-bench/server-cfg.sh1
-rw-r--r--sql-bench/test-ATIS.sh2
-rw-r--r--sql-bench/test-alter-table.sh36
-rw-r--r--sql-bench/test-insert.sh13
4 files changed, 49 insertions, 3 deletions
diff --git a/sql-bench/server-cfg.sh b/sql-bench/server-cfg.sh
index fcdfe0b678f..3991d16c6b1 100644
--- a/sql-bench/server-cfg.sh
+++ b/sql-bench/server-cfg.sh
@@ -131,6 +131,7 @@ sub new
$limits{'alter_add_multi_col'}= 1; #Have ALTER TABLE t add a int,add b int;
$limits{'alter_table'} = 1; # Have ALTER TABLE
$limits{'alter_table_dropcol'}= 1; # Have ALTER TABLE DROP column
+ $limits{'alter_table_after'}= 1; # Have ALTER TABLE .. AFTER other_column
$limits{'column_alias'} = 1; # Alias for fields in select statement.
$limits{'func_extra_%'} = 1; # Has % as alias for mod()
$limits{'func_extra_if'} = 1; # Have function if.
diff --git a/sql-bench/test-ATIS.sh b/sql-bench/test-ATIS.sh
index d3c242db256..d7ef5dca476 100644
--- a/sql-bench/test-ATIS.sh
+++ b/sql-bench/test-ATIS.sh
@@ -369,7 +369,7 @@ sub init_data
@class_of_service=
$server->create("class_of_service",
["class_code char(2) NOT NULL",
- "rank tinyint(2) NOT NULL",
+ "`rank` tinyint(2) NOT NULL",
"class_description char(80) NOT NULL"],
["PRIMARY KEY (class_code)"]);
@code_description=
diff --git a/sql-bench/test-alter-table.sh b/sql-bench/test-alter-table.sh
index 3a7f325b604..e092453b16a 100644
--- a/sql-bench/test-alter-table.sh
+++ b/sql-bench/test-alter-table.sh
@@ -202,9 +202,10 @@ while ($field_count > $opt_start_field_count)
$count++;
$end=max($field_count-$add,$opt_start_field_count);
$fields="";
- while(--$field_count >= $end)
+ while ($field_count > $end)
{
$fields.=",DROP i${field_count}";
+ $field_count--;
}
$dbh->do("ALTER TABLE bench " . substr($fields,1) . $server->{'drop_attr'})
|| die $DBI::errstr;
@@ -221,6 +222,39 @@ else
print " for alter_table_drop ($count): " .
timestr(timediff($end_time, $loop_time),"all") . "\n\n";
+####
+#### Add fields in middle of the table
+####
+
+goto skip_dropcol if (!$limits->{'alter_table_after'});
+
+$count=0;
+while ($field_count < $opt_field_count)
+{
+ $count++;
+ $end=min($field_count+$add,$opt_field_count);
+ $fields="";
+ $tmp="ADD ";
+ while ($field_count < $end)
+ {
+ $field_count++;
+ $fields.=",$tmp i${field_count} integer after i1";
+ $tmp="" if (!$multi_add); # Adabas
+ }
+ do_query($dbh,"ALTER TABLE bench " . substr($fields,1));
+ $end_time=new Benchmark;
+ last if ($estimated=predict_query_time($loop_time,$end_time,\$count,$count,
+ $opt_field_count/$add+1));
+}
+
+$end_time=new Benchmark;
+if ($estimated)
+{ print "Estimated time"; }
+else
+{ print "Time"; }
+print " for alter_table_add_in_middle ($count): " .
+ timestr(timediff($end_time, $loop_time),"all") . "\n\n";
+
skip_dropcol:
################################ END ###################################
diff --git a/sql-bench/test-insert.sh b/sql-bench/test-insert.sh
index be57b04471a..3e35ac5ff5c 100644
--- a/sql-bench/test-insert.sh
+++ b/sql-bench/test-insert.sh
@@ -993,11 +993,22 @@ $end_time=new Benchmark;
print "Time for update_with_key (" . ($opt_loop_count*3) . "): " .
timestr(timediff($end_time, $loop_time),"all") . "\n";
+print "Testing update with key, no changes in data\n";
+$loop_time=new Benchmark;
+for ($i=0 ; $i < $opt_loop_count*3 ; $i++)
+{
+ $sth = $dbh->do("update bench1 set dummy1='updated' where id=$i and id2=$i") or die $DBI::errstr;
+}
+
+$end_time=new Benchmark;
+print "Time for update_with_key_record_unchanged (" . ($opt_loop_count*3) . "): " .
+ timestr(timediff($end_time, $loop_time),"all") . "\n";
+
$loop_time=new Benchmark;
$count=0;
for ($i=1 ; $i < $opt_loop_count*3 ; $i+=3)
{
- $sth = $dbh->do("update bench1 set dummy1='updated' where id=$i") or die $DBI::errstr;
+ $sth = $dbh->do("update bench1 set dummy1='really updated' where id=$i") or die $DBI::errstr;
$end_time=new Benchmark;
last if ($estimated=predict_query_time($loop_time,$end_time,\$i,($i-1)/3,
$opt_loop_count));