#!/perl use strict; use warnings FATAL => qw(all); use DBI; use File::Spec; use Time::HiRes qw (time); my $MEMORY = 1; my $start = time; my $PATH = "C:/TMP/___TMP/_TRASH"; my $dbfile = File::Spec->catdir($PATH, 'Big_DB.db'); my $dbh; if (1 == $MEMORY) { $dbh = DBI->connect('dbi:SQLite:dbname=:memory:',"","",{RaiseError => 1}) or die "Couldn't connect to database: " . DBI->errstr; } else { $dbh = DBI->connect("dbi:SQLite:dbname=$dbfile","","",{RaiseError => 1}) or die "Couldn't connect to database: " . DBI->errstr; } print "Time till connect: ", time() - $start, $/; $start = time; if (1 == $MEMORY) { $dbh->sqlite_backup_from_file($dbfile); } print "Time till load: ", time() - $start, $/; $start = time; # Marker. my $sth = $dbh->prepare("select Name, Writeups from employees e, groups g where e.Level = g.Level and g.Level = 'Pope (28)' order by e.Writeups desc "); print "Time till prepare: ", time() - $start, $/; $start = time; $sth->execute(); print "Time till execute: ", time() - $start, $/; $start = time; my $answer = 0; while ( my ($name, $writeups) = $sth->fetchrow_array ) { $answer += 1; # print join(';', ($name, $writeups)), $/; } print "Answer: $answer\n"; print "Time after loop: ", time() - $start, $/; $start = time; $dbh->disconnect;