As with other SQLite3 databases, copy-on-write with
files experiencing random writes leads to write amplification
and low performance.
---
 lib/PublicInbox/LeiMailSync.pm | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/lib/PublicInbox/LeiMailSync.pm b/lib/PublicInbox/LeiMailSync.pm
index 690c6477..f185b585 100644
--- a/lib/PublicInbox/LeiMailSync.pm
+++ b/lib/PublicInbox/LeiMailSync.pm
@@ -14,6 +14,11 @@ sub dbh_new {
        my ($self, $rw) = @_;
        my $f = $self->{filename};
        my $creat = $rw && !-s $f;
+       if ($creat) {
+               require PublicInbox::Spawn;
+               open my $fh, '+>>', $f or Carp::croak "open($f): $!";
+               PublicInbox::Spawn::nodatacow_fd(fileno($fh));
+       }
        my $dbh = DBI->connect("dbi:SQLite:dbname=$f",'','', {
                AutoCommit => 1,
                RaiseError => 1,
--
unsubscribe: one-click, see List-Unsubscribe header
archive: https://public-inbox.org/meta/

Reply via email to