#!/usr/bin/env perl # Copyright (c) 2001, 2003, 2006 MySQL AB, 2009 Sun Microsystems, Inc. # Use is subject to license terms. # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; version 2 # of the License. # # This library is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Library General Public License for more details. # # You should have received a copy of the GNU Library General Public # License along with this library; if not, write to the Free # Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, # MA 02110-1335 USA # # Test of transactions performance. #
##################### Standard benchmark inits ##############################
use Cwd;
use DBI;
use Benchmark; #use warnings;
$opt_groups=27; # Characters are 'A' -> Z
$opt_loop_count=500000; # Change this to make test harder/easier
$opt_medium_loop_count=10000; # Change this to make test harder/easier
do_many($dbh,$server->create("bench1",
["idn int NOT NULL", "rev_idn int NOT NULL", "region char(1) NOT NULL", "grp int NOT NULL", "updated tinyint NOT NULL"],
["primary key (idn)", "unique (region,grp)"]));
do_many($dbh,$server->create("bench2",
["idn int NOT NULL", "rev_idn int NOT NULL", "region char(1) NOT NULL", "grp int NOT NULL", "updated tinyint NOT NULL"],
["primary key (idn)", "unique (region,grp)"]));
$dbh->{AutoCommit} = 0;
### ### Test insert perfomance ###
if ($server->{transactions})
{
test_insert("bench1","insert_commit",0);
}
test_insert("bench2","insert_autocommit",1);
sub test_insert
{
my ($table, $test_name, $auto_commit)= @_;
my ($loop_time,$end_time,$id,$rev_id,$grp,$region);
for ($id=0 ; $id < $opt_loop_count ; $id++)
{
do_query($dbh,"delete from $table where idn=$id");
}
$dbh->commit if (!$auto_commit);
$end_time=new Benchmark;
print "Time for $test_name ($opt_loop_count): " .
timestr(timediff($end_time, $loop_time),"all") . "\n\n";
}
#### #### End of benchmark ####
$sth = $dbh->do("drop table bench1" . $server->{'drop_attr'}) or die $DBI::errstr;
$sth = $dbh->do("drop table bench2" . $server->{'drop_attr'}) or die $DBI::errstr;
$dbh->disconnect; # close connection
end_benchmark($start_time);
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.19 Sekunden
(vorverarbeitet am 2026-10-08)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.