summaryrefslogtreecommitdiff
path: root/sql-bench
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2018-04-27 08:26:28 +0300
committerMonty <monty@mariadb.org>2018-04-30 14:05:27 +0300
commit862e602b5a5bbc79bacdac9722f1ab69d0ccf7c3 (patch)
treef643008ad3874dc8070d00989a2e82c6b45f816d /sql-bench
parentcb16bc95ff9a7b4ce0835acf8fa6d6a06ad10c3c (diff)
downloadmariadb-git-862e602b5a5bbc79bacdac9722f1ab69d0ccf7c3.tar.gz
Added more test to sql-bench
- test-alter now correctly drops all columns - test-alter has a new test that times adding columns in middle of table - test-insert has a new test to check updates that doesn't change data - test-insert: update_with_key_prefix didn't change data. Now fixed
Diffstat (limited to 'sql-bench')
-rw-r--r--sql-bench/server-cfg.sh1
-rw-r--r--sql-bench/test-alter-table.sh36
-rw-r--r--sql-bench/test-insert.sh13
3 files changed, 48 insertions, 2 deletions
diff --git a/sql-bench/server-cfg.sh b/sql-bench/server-cfg.sh
index 7e83b7365e3..78ad43d6b2d 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-alter-table.sh b/sql-bench/test-alter-table.sh
index 6dc5ce35841..2dc96affdd3 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 e264c7d529f..f4b47908d9b 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));