use DBI; use strict; use warnings; use Benchmark::Timer; use Data::Dumper; my $t = Benchmark::Timer->new; $t->start('main'); my $h = DBI->connect; if ($ARGV[0]) { print "Recreating table\n"; eval {$h->do(q/drop table mje/);}; $h->do(q/create table mje (a varchar(50), b varchar(50), c varchar(50), d varchar(50))/); $h->begin_work; my $s = $h->prepare(q/insert into mje values(?,?,?,?)/); my $a = 'a' x 50; my $b = 'b' x 50; my $c = 'c' x 50; my $d = 'd' x 50; foreach (1..50000) { $s->execute($a, $b, $c, $d); } $h->commit; } $t->stop('main'); $t->start('fetch'); my $r = $h->selectall_arrayref(q/select * from mje/); $t->stop('fetch'); $t->start('dump'); print Dumper($r); $t->stop('dump'); print "Rows fetched:", scalar(@$r), "\n"; print $t->reports; #### many many lines like the following [ 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb', 'cccccccccccccccccccccccccccccccccccccccccccccccccc', 'dddddddddddddddddddddddddddddddddddddddddddddddddd' ] Rows fetched:50000 main1 trial of main (44.867ms total) fetch1 trial of fetch (1.715s total) dump1 trial of dump (31.614s total)