if ($writable) {
create_tables($dbh);
+
+ # TRUNCATE reduces I/O compared to the default (DELETE)
+ $dbh->do('PRAGMA journal_mode = TRUNCATE');
+
$dbh->begin_work;
$self->created_at(time) unless $self->created_at;
$self->{dbh}->sqlite_backup_to_file($fn);
my $tmp = ref($self)->new_file($fn, 1);
$tmp->{dbh}->do('PRAGMA synchronous = OFF');
+ $tmp->{dbh}->do('PRAGMA journal_mode = MEMORY');
$tmp->{tmp_name} = $fn; # SQLite won't work if unlinked, apparently
$tmp->{pid} = $$;
close $fh or die "failed to close $fn: $!";