in reply to Re^2: Efficient search through a huge dataset
in thread Efficient search through a huge dataset

it took SQLite 310 seconds to insert

The SQLite docs say what you should do to improve speed: group instructions into transactions and eventually modify the "syncronous" pragma.

If you add $dbh->do('begin'); before your loop and $dbh->do('commit'); at the end, the insertion will take less than one second, as it should be.

use Time::HiRes qw(gettimeofday tv_interval); my $start_time = [gettimeofday]; $dbh->do('begin'); for my $i (1..1000) { $st1->execute($i, $i * 2); if ($i % 2) { $st2->execute($i, $i * 3); } } $dbh->do('commit'); my $elapsed = tv_interval ( $start_time, [gettimeofday]); print "creation time: $elapsed\n"; __END__ insertion time: 0.263462

Replies are listed 'Best First'.
A reply falls below the community's threshold of quality. You may see it by logging in.