mirror of
https://github.com/MariaDB/server.git
synced 2025-08-05 13:16:09 +03:00
--fast now does all insert/update loops in one transactions
This commit is contained in:
@@ -121,6 +121,7 @@ sub new
|
|||||||
$self->{'double_quotes'} = 1; # Can handle: 'Walker''s'
|
$self->{'double_quotes'} = 1; # Can handle: 'Walker''s'
|
||||||
$self->{'vacuum'} = 1; # When using with --fast
|
$self->{'vacuum'} = 1; # When using with --fast
|
||||||
$self->{'drop_attr'} = "";
|
$self->{'drop_attr'} = "";
|
||||||
|
$self->{'transactions'} = 1; # Transactions enabled
|
||||||
|
|
||||||
$limits{'NEG'} = 1; # Supports -id
|
$limits{'NEG'} = 1; # Supports -id
|
||||||
$limits{'alter_add_multi_col'}= 1; #Have ALTER TABLE t add a int,add b int;
|
$limits{'alter_add_multi_col'}= 1; #Have ALTER TABLE t add a int,add b int;
|
||||||
@@ -370,6 +371,7 @@ sub new
|
|||||||
$self->{'limits'} = \%limits;
|
$self->{'limits'} = \%limits;
|
||||||
$self->{'double_quotes'} = 0;
|
$self->{'double_quotes'} = 0;
|
||||||
$self->{'drop_attr'} = "";
|
$self->{'drop_attr'} = "";
|
||||||
|
$self->{'transactions'} = 0; # No transactions
|
||||||
$self->{'blob'} = "text(" . $limits{'max_text_size'} .")";
|
$self->{'blob'} = "text(" . $limits{'max_text_size'} .")";
|
||||||
$self->{'text'} = "text(" . $limits{'max_text_size'} .")";
|
$self->{'text'} = "text(" . $limits{'max_text_size'} .")";
|
||||||
|
|
||||||
@@ -565,6 +567,7 @@ sub new
|
|||||||
$self->{'text'} = "text";
|
$self->{'text'} = "text";
|
||||||
$self->{'double_quotes'} = 1;
|
$self->{'double_quotes'} = 1;
|
||||||
$self->{'drop_attr'} = "";
|
$self->{'drop_attr'} = "";
|
||||||
|
$self->{'transactions'} = 1; # Transactions enabled
|
||||||
$self->{"vacuum"} = 1;
|
$self->{"vacuum"} = 1;
|
||||||
$limits{'join_optimizer'} = 1; # Can optimize FROM tables
|
$limits{'join_optimizer'} = 1; # Can optimize FROM tables
|
||||||
$limits{'load_data_infile'} = 0;
|
$limits{'load_data_infile'} = 0;
|
||||||
@@ -854,6 +857,7 @@ sub new
|
|||||||
$self->{'text'} = "long varchar";
|
$self->{'text'} = "long varchar";
|
||||||
$self->{'double_quotes'} = 1;
|
$self->{'double_quotes'} = 1;
|
||||||
$self->{'drop_attr'} = "";
|
$self->{'drop_attr'} = "";
|
||||||
|
$self->{'transactions'} = 1; # Transactions enabled
|
||||||
|
|
||||||
$limits{'max_conditions'} = 9999; # Probably big enough
|
$limits{'max_conditions'} = 9999; # Probably big enough
|
||||||
$limits{'max_columns'} = 2000; # From crash-me
|
$limits{'max_columns'} = 2000; # From crash-me
|
||||||
@@ -1095,6 +1099,7 @@ sub new
|
|||||||
$self->{'text'} = "text";
|
$self->{'text'} = "text";
|
||||||
$self->{'double_quotes'} = 1; # Can handle: 'Walker''s'
|
$self->{'double_quotes'} = 1; # Can handle: 'Walker''s'
|
||||||
$self->{'drop_attr'} = "";
|
$self->{'drop_attr'} = "";
|
||||||
|
$self->{'transactions'} = 1; # Transactions enabled
|
||||||
|
|
||||||
$limits{'max_conditions'} = 1258;
|
$limits{'max_conditions'} = 1258;
|
||||||
$limits{'max_columns'} = 226; # server is disconnecting????
|
$limits{'max_columns'} = 226; # server is disconnecting????
|
||||||
@@ -1377,6 +1382,7 @@ sub new
|
|||||||
$self->{'text'} = "long";
|
$self->{'text'} = "long";
|
||||||
$self->{'double_quotes'} = 1; # Can handle: 'Walker''s'
|
$self->{'double_quotes'} = 1; # Can handle: 'Walker''s'
|
||||||
$self->{'drop_attr'} = "";
|
$self->{'drop_attr'} = "";
|
||||||
|
$self->{'transactions'} = 1; # Transactions enabled
|
||||||
$self->{"vacuum"} = 1;
|
$self->{"vacuum"} = 1;
|
||||||
|
|
||||||
$limits{'max_conditions'} = 9999; # (Actually not a limit)
|
$limits{'max_conditions'} = 9999; # (Actually not a limit)
|
||||||
@@ -1633,6 +1639,7 @@ sub new
|
|||||||
$self->{'text'} = "byte in table";
|
$self->{'text'} = "byte in table";
|
||||||
$self->{'double_quotes'} = 0; # Can handle: 'Walker''s'
|
$self->{'double_quotes'} = 0; # Can handle: 'Walker''s'
|
||||||
$self->{'drop_attr'} = "";
|
$self->{'drop_attr'} = "";
|
||||||
|
$self->{'transactions'} = 1; # Transactions enabled
|
||||||
$self->{'host'} = $host;
|
$self->{'host'} = $host;
|
||||||
|
|
||||||
$limits{'NEG'} = 1; # Supports -id
|
$limits{'NEG'} = 1; # Supports -id
|
||||||
@@ -1834,6 +1841,7 @@ sub new
|
|||||||
$self->{'text'} = "blob"; # text ?
|
$self->{'text'} = "blob"; # text ?
|
||||||
$self->{'double_quotes'} = 1; # Can handle: 'Walker''s'
|
$self->{'double_quotes'} = 1; # Can handle: 'Walker''s'
|
||||||
$self->{'drop_attr'} = "";
|
$self->{'drop_attr'} = "";
|
||||||
|
$self->{'transactions'} = 1; # Transactions enabled
|
||||||
|
|
||||||
$limits{'max_conditions'} = 97; # We get 'Query is too complex'
|
$limits{'max_conditions'} = 97; # We get 'Query is too complex'
|
||||||
$limits{'max_columns'} = 255; # Max number of columns in table
|
$limits{'max_columns'} = 255; # Max number of columns in table
|
||||||
@@ -2010,6 +2018,7 @@ sub new
|
|||||||
$self->{'text'} = "text";
|
$self->{'text'} = "text";
|
||||||
$self->{'double_quotes'} = 1; # Can handle: 'Walker''s'
|
$self->{'double_quotes'} = 1; # Can handle: 'Walker''s'
|
||||||
$self->{'drop_attr'} = "";
|
$self->{'drop_attr'} = "";
|
||||||
|
$self->{'transactions'} = 1; # Transactions enabled
|
||||||
|
|
||||||
$limits{'max_conditions'} = 1030; # We get 'Query is too complex'
|
$limits{'max_conditions'} = 1030; # We get 'Query is too complex'
|
||||||
$limits{'max_columns'} = 250; # Max number of columns in table
|
$limits{'max_columns'} = 250; # Max number of columns in table
|
||||||
@@ -2197,6 +2206,7 @@ sub new
|
|||||||
$self->{'text'} = "text";
|
$self->{'text'} = "text";
|
||||||
$self->{'double_quotes'} = 1; # Can handle: 'Walker''s'
|
$self->{'double_quotes'} = 1; # Can handle: 'Walker''s'
|
||||||
$self->{'drop_attr'} = "";
|
$self->{'drop_attr'} = "";
|
||||||
|
$self->{'transactions'} = 1; # Transactions enabled
|
||||||
$self->{"vacuum"} = 1;
|
$self->{"vacuum"} = 1;
|
||||||
|
|
||||||
$limits{'max_conditions'} = 1030; # We get 'Query is too complex'
|
$limits{'max_conditions'} = 1030; # We get 'Query is too complex'
|
||||||
@@ -2389,6 +2399,7 @@ sub new
|
|||||||
$self->{'text'} = "long";
|
$self->{'text'} = "long";
|
||||||
$self->{'double_quotes'} = 1; # Can handle: 'Walker''s'
|
$self->{'double_quotes'} = 1; # Can handle: 'Walker''s'
|
||||||
$self->{'drop_attr'} = "";
|
$self->{'drop_attr'} = "";
|
||||||
|
$self->{'transactions'} = 1; # Transactions enabled
|
||||||
|
|
||||||
$limits{'max_conditions'} = 50; # (Actually not a limit)
|
$limits{'max_conditions'} = 50; # (Actually not a limit)
|
||||||
$limits{'max_columns'} = 254; # Max number of columns in table
|
$limits{'max_columns'} = 254; # Max number of columns in table
|
||||||
@@ -2603,6 +2614,7 @@ sub new
|
|||||||
$self->{'text'} = "varchar(255)";
|
$self->{'text'} = "varchar(255)";
|
||||||
$self->{'double_quotes'} = 1; # Can handle: 'Walker''s'
|
$self->{'double_quotes'} = 1; # Can handle: 'Walker''s'
|
||||||
$self->{'drop_attr'} = "";
|
$self->{'drop_attr'} = "";
|
||||||
|
$self->{'transactions'} = 1; # Transactions enabled
|
||||||
|
|
||||||
$limits{'max_conditions'} = 418; # We get 'Query is too complex'
|
$limits{'max_conditions'} = 418; # We get 'Query is too complex'
|
||||||
$limits{'max_columns'} = 500; # Max number of columns in table
|
$limits{'max_columns'} = 500; # Max number of columns in table
|
||||||
@@ -2772,6 +2784,7 @@ sub new
|
|||||||
$self->{'text'} = "character varying(15000)";
|
$self->{'text'} = "character varying(15000)";
|
||||||
$self->{'double_quotes'} = 1; # Can handle: 'Walker''s'
|
$self->{'double_quotes'} = 1; # Can handle: 'Walker''s'
|
||||||
$self->{'drop_attr'} = "";
|
$self->{'drop_attr'} = "";
|
||||||
|
$self->{'transactions'} = 1; # Transactions enabled
|
||||||
$self->{'char_null'} = "cast(NULL as char(1))";
|
$self->{'char_null'} = "cast(NULL as char(1))";
|
||||||
$self->{'numeric_null'} = "cast(NULL as int)";
|
$self->{'numeric_null'} = "cast(NULL as int)";
|
||||||
|
|
||||||
@@ -2972,6 +2985,7 @@ sub new
|
|||||||
$self->{'text'} = "";
|
$self->{'text'} = "";
|
||||||
$self->{'double_quotes'} = 1; # Can handle: 'Walker''s'
|
$self->{'double_quotes'} = 1; # Can handle: 'Walker''s'
|
||||||
$self->{'drop_attr'} = "";
|
$self->{'drop_attr'} = "";
|
||||||
|
$self->{'transactions'} = 1; # Transactions enabled
|
||||||
$self->{'char_null'} = "";
|
$self->{'char_null'} = "";
|
||||||
$self->{'numeric_null'} = "";
|
$self->{'numeric_null'} = "";
|
||||||
|
|
||||||
@@ -3184,6 +3198,7 @@ sub new
|
|||||||
$self->{'text'} = "varchar(8000000)";
|
$self->{'text'} = "varchar(8000000)";
|
||||||
$self->{'double_quotes'} = 1; # Can handle: 'Walker''s'
|
$self->{'double_quotes'} = 1; # Can handle: 'Walker''s'
|
||||||
$self->{'drop_attr'} = ' restrict';
|
$self->{'drop_attr'} = ' restrict';
|
||||||
|
$self->{'transactions'} = 1; # Transactions enabled
|
||||||
$self->{'error_on_execute_means_zero_rows'}=1;
|
$self->{'error_on_execute_means_zero_rows'}=1;
|
||||||
|
|
||||||
$limits{'max_conditions'} = 5427; # (Actually not a limit)
|
$limits{'max_conditions'} = 5427; # (Actually not a limit)
|
||||||
|
@@ -106,6 +106,12 @@ if (!$opt_skip_create)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if ($opt_fast && $server->{transactions})
|
||||||
|
{
|
||||||
|
$dbh->{AutoCommit} = 0;
|
||||||
|
print "Transactions enabled\n" if ($opt_debug);
|
||||||
|
}
|
||||||
|
|
||||||
for ($ti = 0; $ti <= $#table_names; $ti++)
|
for ($ti = 0; $ti <= $#table_names; $ti++)
|
||||||
{
|
{
|
||||||
my $table_name = $table_names[$ti];
|
my $table_name = $table_names[$ti];
|
||||||
@@ -128,8 +134,14 @@ if (!$opt_skip_create)
|
|||||||
$row_count++;
|
$row_count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ($opt_fast && $server->{transactions})
|
||||||
|
{
|
||||||
|
$dbh->commit;
|
||||||
|
$dbh->{AutoCommit} = 1;
|
||||||
|
}
|
||||||
close(DATA);
|
close(DATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($opt_lock_tables)
|
if ($opt_lock_tables)
|
||||||
{
|
{
|
||||||
$dbh->do("UNLOCK TABLES");
|
$dbh->do("UNLOCK TABLES");
|
||||||
|
@@ -74,11 +74,25 @@ do_many($dbh,$server->create("bench",\@fields,\@index));
|
|||||||
print "Insert data into the table\n";
|
print "Insert data into the table\n";
|
||||||
|
|
||||||
$loop_time=new Benchmark;
|
$loop_time=new Benchmark;
|
||||||
|
|
||||||
|
if ($opt_fast && defined($server->{transactions}))
|
||||||
|
{
|
||||||
|
$dbh->{AutoCommit} = 0;
|
||||||
|
print "Transactions enabled\n" if ($opt_debug);
|
||||||
|
}
|
||||||
|
|
||||||
for ($i=0 ; $i < $opt_row_count ; $i++)
|
for ($i=0 ; $i < $opt_row_count ; $i++)
|
||||||
{
|
{
|
||||||
$query="insert into bench values ( " . ("$i," x ($opt_start_field_count-1)) . "$i)";
|
$query="insert into bench values ( " . ("$i," x ($opt_start_field_count-1)) . "$i)";
|
||||||
$dbh->do($query) or die $DBI::errstr;
|
$dbh->do($query) or die $DBI::errstr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($opt_fast && defined($server->{transactions}))
|
||||||
|
{
|
||||||
|
$dbh->commit;
|
||||||
|
$dbh->{AutoCommit} = 1;
|
||||||
|
}
|
||||||
|
|
||||||
$end_time=new Benchmark;
|
$end_time=new Benchmark;
|
||||||
|
|
||||||
print "Time for insert ($opt_row_count)",
|
print "Time for insert ($opt_row_count)",
|
||||||
|
@@ -127,14 +127,28 @@ end_benchmark($start_time);
|
|||||||
sub test_query
|
sub test_query
|
||||||
{
|
{
|
||||||
my($test_text,$result_text,$query,$dbh,$count)=@_;
|
my($test_text,$result_text,$query,$dbh,$count)=@_;
|
||||||
my($i,$loop_time,$end_time);
|
my($i,$loop_time,$end_time, $using_transactions);
|
||||||
|
|
||||||
print $test_text . "\n";
|
print $test_text . "\n";
|
||||||
$loop_time=new Benchmark;
|
$loop_time=new Benchmark;
|
||||||
|
|
||||||
|
$using_transactions=0;
|
||||||
|
if ($opt_fast && server->{transactions} && $query=~ /^insert /i)
|
||||||
|
{
|
||||||
|
$using_transactions=1;
|
||||||
|
$dbh->{AutoCommit} = 0;
|
||||||
|
print "Transactions enabled\n" if ($opt_debug);
|
||||||
|
}
|
||||||
for ($i=0 ; $i < $count ; $i++)
|
for ($i=0 ; $i < $count ; $i++)
|
||||||
{
|
{
|
||||||
defined(fetch_all_rows($dbh,$query)) or die $DBI::errstr;
|
defined(fetch_all_rows($dbh,$query)) or die $DBI::errstr;
|
||||||
}
|
}
|
||||||
|
if ($using_transactions)
|
||||||
|
{
|
||||||
|
$dbh->commit;
|
||||||
|
$dbh->{AutoCommit} = 1;
|
||||||
|
}
|
||||||
|
|
||||||
$end_time=new Benchmark;
|
$end_time=new Benchmark;
|
||||||
print $result_text . "($count): " .
|
print $result_text . "($count): " .
|
||||||
timestr(timediff($end_time, $loop_time),"all") . "\n\n";
|
timestr(timediff($end_time, $loop_time),"all") . "\n\n";
|
||||||
|
@@ -29,6 +29,7 @@
|
|||||||
|
|
||||||
use DBI;
|
use DBI;
|
||||||
use Benchmark;
|
use Benchmark;
|
||||||
|
use Data::Dumper;
|
||||||
|
|
||||||
$opt_loop_count=100000; # number of rows/3
|
$opt_loop_count=100000; # number of rows/3
|
||||||
$small_loop_count=10; # Loop for full table retrieval
|
$small_loop_count=10; # Loop for full table retrieval
|
||||||
@@ -132,6 +133,12 @@ else
|
|||||||
$query="insert into bench1 (id,id2,id3,dummy1) values ";
|
$query="insert into bench1 (id,id2,id3,dummy1) values ";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($opt_fast && $server->{transactions})
|
||||||
|
{
|
||||||
|
$dbh->{AutoCommit} = 0;
|
||||||
|
print "Transactions enabled\n" if ($opt_debug);
|
||||||
|
}
|
||||||
|
|
||||||
if (($opt_fast || $opt_fast_insert) && $server->{'limits'}->{'insert_multi_value'})
|
if (($opt_fast || $opt_fast_insert) && $server->{'limits'}->{'insert_multi_value'})
|
||||||
{
|
{
|
||||||
$query_size=$server->{'limits'}->{'query_size'};
|
$query_size=$server->{'limits'}->{'query_size'};
|
||||||
@@ -209,6 +216,12 @@ else
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($opt_fast && $server->{transactions})
|
||||||
|
{
|
||||||
|
$dbh->commit;
|
||||||
|
$dbh->{AutoCommit} = 1;
|
||||||
|
}
|
||||||
|
|
||||||
$end_time=new Benchmark;
|
$end_time=new Benchmark;
|
||||||
print "Time for insert (" . ($total_rows) . "): " .
|
print "Time for insert (" . ($total_rows) . "): " .
|
||||||
timestr(timediff($end_time, $loop_time),"all") . "\n\n";
|
timestr(timediff($end_time, $loop_time),"all") . "\n\n";
|
||||||
@@ -234,6 +247,12 @@ if ($limits->{'unique_index'})
|
|||||||
{
|
{
|
||||||
print "Testing insert of duplicates\n";
|
print "Testing insert of duplicates\n";
|
||||||
$loop_time=new Benchmark;
|
$loop_time=new Benchmark;
|
||||||
|
|
||||||
|
if ($opt_fast && $server->{transactions})
|
||||||
|
{
|
||||||
|
$dbh->{AutoCommit} = 0;
|
||||||
|
}
|
||||||
|
|
||||||
for ($i=0 ; $i < $opt_loop_count ; $i++)
|
for ($i=0 ; $i < $opt_loop_count ; $i++)
|
||||||
{
|
{
|
||||||
$tmpvar^= ((($tmpvar + 63) + $i)*3 % $opt_loop_count);
|
$tmpvar^= ((($tmpvar + 63) + $i)*3 % $opt_loop_count);
|
||||||
@@ -244,6 +263,11 @@ if ($limits->{'unique_index'})
|
|||||||
die "Didn't get an error when inserting duplicate record $tmp\n";
|
die "Didn't get an error when inserting duplicate record $tmp\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ($opt_fast && $server->{transactions})
|
||||||
|
{
|
||||||
|
$dbh->commit;
|
||||||
|
$dbh->{AutoCommit} = 1;
|
||||||
|
}
|
||||||
|
|
||||||
$end_time=new Benchmark;
|
$end_time=new Benchmark;
|
||||||
print "Time for insert_duplicates (" . ($opt_loop_count) . "): " .
|
print "Time for insert_duplicates (" . ($opt_loop_count) . "): " .
|
||||||
@@ -577,7 +601,6 @@ if ($limits->{'group_functions'})
|
|||||||
}
|
}
|
||||||
$sth->finish;
|
$sth->finish;
|
||||||
|
|
||||||
|
|
||||||
$count++;
|
$count++;
|
||||||
$sth=$dbh->prepare($query="select count(*),sum(id+0.0),min(id),max(id),avg(id-0.0) from bench1") or die $DBI::errstr;
|
$sth=$dbh->prepare($query="select count(*),sum(id+0.0),min(id),max(id),avg(id-0.0) from bench1") or die $DBI::errstr;
|
||||||
$sth->execute or die $DBI::errstr;
|
$sth->execute or die $DBI::errstr;
|
||||||
@@ -1250,6 +1273,11 @@ if ($server->small_rollback_segment())
|
|||||||
}
|
}
|
||||||
|
|
||||||
$loop_time=new Benchmark;
|
$loop_time=new Benchmark;
|
||||||
|
if ($opt_fast && $server->{transactions})
|
||||||
|
{
|
||||||
|
$dbh->{AutoCommit} = 0;
|
||||||
|
}
|
||||||
|
|
||||||
$fields=$#fields;
|
$fields=$#fields;
|
||||||
if (($opt_fast || $opt_fast_insert) && $server->{'limits'}->{'insert_multi_value'})
|
if (($opt_fast || $opt_fast_insert) && $server->{'limits'}->{'insert_multi_value'})
|
||||||
{
|
{
|
||||||
@@ -1297,6 +1325,13 @@ else
|
|||||||
$dbh->do($query) or die "Got error $DBI::errstr with query: $query\n";
|
$dbh->do($query) or die "Got error $DBI::errstr with query: $query\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($opt_fast && $server->{transactions})
|
||||||
|
{
|
||||||
|
$dbh->commit;
|
||||||
|
$dbh->{AutoCommit} = 1;
|
||||||
|
}
|
||||||
|
|
||||||
$end_time=new Benchmark;
|
$end_time=new Benchmark;
|
||||||
print "Time for insert_key ($many_keys_loop_count): " .
|
print "Time for insert_key ($many_keys_loop_count): " .
|
||||||
timestr(timediff($end_time, $loop_time),"all") . "\n\n";
|
timestr(timediff($end_time, $loop_time),"all") . "\n\n";
|
||||||
@@ -1325,11 +1360,24 @@ if ($opt_fast && defined($server->{vacuum}))
|
|||||||
|
|
||||||
print "Testing update of keys\n";
|
print "Testing update of keys\n";
|
||||||
$loop_time=new Benchmark;
|
$loop_time=new Benchmark;
|
||||||
|
|
||||||
|
if ($opt_fast && $server->{transactions})
|
||||||
|
{
|
||||||
|
$dbh->{AutoCommit} = 0;
|
||||||
|
}
|
||||||
|
|
||||||
for ($i=0 ; $i< 256; $i++)
|
for ($i=0 ; $i< 256; $i++)
|
||||||
{
|
{
|
||||||
$dbh->do("update bench1 set field5=1 where field_search=$i")
|
$dbh->do("update bench1 set field5=1 where field_search=$i")
|
||||||
or die "Got error $DBI::errstr with query: update bench1 set field5=1 where field_search=$i\n";
|
or die "Got error $DBI::errstr with query: update bench1 set field5=1 where field_search=$i\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($opt_fast && $server->{transactions})
|
||||||
|
{
|
||||||
|
$dbh->commit;
|
||||||
|
$dbh->{AutoCommit} = 1;
|
||||||
|
}
|
||||||
|
|
||||||
$end_time=new Benchmark;
|
$end_time=new Benchmark;
|
||||||
print "Time for update_of_primary_key_many_keys (256): " .
|
print "Time for update_of_primary_key_many_keys (256): " .
|
||||||
timestr(timediff($end_time, $loop_time),"all") . "\n\n";
|
timestr(timediff($end_time, $loop_time),"all") . "\n\n";
|
||||||
@@ -1420,12 +1468,18 @@ if ($limits->{'insert_multi_value'})
|
|||||||
"dummy1 char(30)"],
|
"dummy1 char(30)"],
|
||||||
["primary key (id,id2)",
|
["primary key (id,id2)",
|
||||||
"index index_id3 (id3)"]));
|
"index index_id3 (id3)"]));
|
||||||
|
|
||||||
|
$loop_time=new Benchmark;
|
||||||
|
|
||||||
if ($opt_lock_tables)
|
if ($opt_lock_tables)
|
||||||
{
|
{
|
||||||
$sth = $dbh->do("LOCK TABLES bench1 write") || die $DBI::errstr;
|
$sth = $dbh->do("LOCK TABLES bench1 write") || die $DBI::errstr;
|
||||||
}
|
}
|
||||||
|
if ($opt_fast && $server->{transactions})
|
||||||
|
{
|
||||||
|
$dbh->{AutoCommit} = 0;
|
||||||
|
}
|
||||||
|
|
||||||
$loop_time=new Benchmark;
|
|
||||||
print "Inserting $opt_loop_count rows with multiple values\n";
|
print "Inserting $opt_loop_count rows with multiple values\n";
|
||||||
$query="insert into bench1 values ";
|
$query="insert into bench1 values ";
|
||||||
$res=$query;
|
$res=$query;
|
||||||
@@ -1448,6 +1502,11 @@ if ($limits->{'insert_multi_value'})
|
|||||||
{
|
{
|
||||||
$sth = $dbh->do("UNLOCK TABLES ") || die $DBI::errstr;
|
$sth = $dbh->do("UNLOCK TABLES ") || die $DBI::errstr;
|
||||||
}
|
}
|
||||||
|
if ($opt_fast && $server->{transactions})
|
||||||
|
{
|
||||||
|
$dbh->commit;
|
||||||
|
$dbh->{AutoCommit} = 1;
|
||||||
|
}
|
||||||
|
|
||||||
$end_time=new Benchmark;
|
$end_time=new Benchmark;
|
||||||
print "Time for multiple_value_insert (" . ($opt_loop_count) . "): " .
|
print "Time for multiple_value_insert (" . ($opt_loop_count) . "): " .
|
||||||
|
@@ -92,6 +92,12 @@ if ($opt_fast && defined($server->{vacuum}))
|
|||||||
print "Inserting $opt_loop_count rows\n";
|
print "Inserting $opt_loop_count rows\n";
|
||||||
|
|
||||||
$loop_time=new Benchmark;
|
$loop_time=new Benchmark;
|
||||||
|
|
||||||
|
if ($opt_fast && $server->{transactions})
|
||||||
|
{
|
||||||
|
$dbh->{AutoCommit} = 0;
|
||||||
|
}
|
||||||
|
|
||||||
$query="insert into bench1 values (";
|
$query="insert into bench1 values (";
|
||||||
$half_done=$opt_loop_count/2;
|
$half_done=$opt_loop_count/2;
|
||||||
for ($id=0,$rev_id=$opt_loop_count-1 ; $id < $opt_loop_count ; $id++,$rev_id--)
|
for ($id=0,$rev_id=$opt_loop_count-1 ; $id < $opt_loop_count ; $id++,$rev_id--)
|
||||||
@@ -105,6 +111,12 @@ for ($id=0,$rev_id=$opt_loop_count-1 ; $id < $opt_loop_count ; $id++,$rev_id--)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($opt_fast && $server->{transactions})
|
||||||
|
{
|
||||||
|
$dbh->commit;
|
||||||
|
$dbh->{AutoCommit} = 1;
|
||||||
|
}
|
||||||
|
|
||||||
$end_time=new Benchmark;
|
$end_time=new Benchmark;
|
||||||
print "Time to insert ($opt_loop_count): " .
|
print "Time to insert ($opt_loop_count): " .
|
||||||
timestr(timediff($end_time, $loop_time),"all") . "\n\n";
|
timestr(timediff($end_time, $loop_time),"all") . "\n\n";
|
||||||
|
@@ -109,6 +109,11 @@ if ($opt_fast && $server->{'limits'}->{'load_data_infile'})
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if ($opt_fast && $server->{transactions})
|
||||||
|
{
|
||||||
|
$dbh->{AutoCommit} = 0;
|
||||||
|
}
|
||||||
|
|
||||||
for ($ti = 0; $ti <= $#table_names; $ti++)
|
for ($ti = 0; $ti <= $#table_names; $ti++)
|
||||||
{
|
{
|
||||||
my $table_name = $table_names[$ti];
|
my $table_name = $table_names[$ti];
|
||||||
@@ -133,10 +138,17 @@ else
|
|||||||
}
|
}
|
||||||
close(DATA);
|
close(DATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($opt_lock_tables)
|
if ($opt_lock_tables)
|
||||||
{
|
{
|
||||||
do_query($dbh,"UNLOCK TABLES");
|
do_query($dbh,"UNLOCK TABLES");
|
||||||
}
|
}
|
||||||
|
if ($opt_fast && $server->{transactions})
|
||||||
|
{
|
||||||
|
$dbh->commit;
|
||||||
|
$dbh->{AutoCommit} = 1;
|
||||||
|
}
|
||||||
|
|
||||||
$end_time=new Benchmark;
|
$end_time=new Benchmark;
|
||||||
print "Time to insert ($row_count): " .
|
print "Time to insert ($row_count): " .
|
||||||
timestr(timediff($end_time, $loop_time),"all") . "\n";
|
timestr(timediff($end_time, $loop_time),"all") . "\n";
|
||||||
|
Reference in New Issue
Block a user