about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@yhbt.net>2020-05-10 22:37:14 +0000
committerEric Wong <e@yhbt.net>2020-05-12 06:16:03 +0000
commit78888d36fb80889f6b0f8ca6f26edda145c14238 (patch)
tree02edf7690dfaab9b09230376875c085eb5b15c96
parent5ce52f3dd831c623b8899dc4d5655c2d958fa6a0 (diff)
downloadpublic-inbox-78888d36fb80889f6b0f8ca6f26edda145c14238.tar.gz
It avoids I/O on the directory itself, which could prolong
the lifetime of the storage device.
-rw-r--r--lib/PublicInbox/Msgmap.pm4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/PublicInbox/Msgmap.pm b/lib/PublicInbox/Msgmap.pm
index 9523752e..5fe14383 100644
--- a/lib/PublicInbox/Msgmap.pm
+++ b/lib/PublicInbox/Msgmap.pm
@@ -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;