use strict; use Time::HiRes; use DBI; my @engines = ('MyISAM','Innodb','Falcon'); my $dbh = DBI->connect('dbi:mysql:host=127.0.0.1:port=9306:database=test','root'); my @partitioning = ('YES','NO'); foreach my $engine (@engines) { foreach my $partitioning (@partitioning) { my $table_name = $engine.'_'.$partitioning; my $create_sql = "CREATE TABLE `$table_name` (f1 integer) ENGINE=$engine"; $create_sql .= " PARTITION BY HASH(f1) PARTITIONS 365 " if $partitioning eq 'YES'; $dbh->do("DROP TABLE IF EXISTS `$table_name`"); my $start_create = Time::HiRes::time(); $dbh->do($create_sql); my $end_create = Time::HiRes::time(); my $diff_create = $end_create - $start_create; # print "CREATE Engine: $engine, partitioning $partitioning, time $diff_create.\n"; my $start_insert = Time::HiRes::time(); foreach my $i (1..10000) { $dbh->do("INSERT INTO $table_name VALUES (NULL)"); } my $end_insert = Time::HiRes::time(); my $diff_insert = $end_insert - $start_insert; print "INSERT Engine: $engine, partitioning $partitioning, time $diff_insert.\n"; } }