diff options
author | Monty <monty@mariadb.org> | 2018-04-27 08:26:28 +0300 |
---|---|---|
committer | Monty <monty@mariadb.org> | 2018-04-30 14:05:27 +0300 |
commit | 862e602b5a5bbc79bacdac9722f1ab69d0ccf7c3 (patch) | |
tree | f643008ad3874dc8070d00989a2e82c6b45f816d /sql-bench/test-alter-table.sh | |
parent | cb16bc95ff9a7b4ce0835acf8fa6d6a06ad10c3c (diff) | |
download | mariadb-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/test-alter-table.sh')
-rw-r--r-- | sql-bench/test-alter-table.sh | 36 |
1 files changed, 35 insertions, 1 deletions
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 ################################### |