]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/Msgmap.pm
nntp: smsg_range_i: favor ->{$field} lookups when possible
[public-inbox.git] / lib / PublicInbox / Msgmap.pm
index 9523752e9af07f8b973ac45d5a5aeda408801513..a2ffe7203e74c026af8675fea0922c026740f7f7 100644 (file)
@@ -48,6 +48,10 @@ sub new_file {
 
        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;
 
@@ -66,6 +70,7 @@ sub tmp_clone {
        $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: $!";