From b75e6fd3159896966dce2cf3af5b5be7e286ce1a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= <joerg@thalheim.io>
Date: Mon, 6 Nov 2023 15:56:26 +0100
Subject: [PATCH] make atuin on zfs fast again
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Jörg Thalheim <joerg@thalheim.io>
---
 atuin-client/src/database.rs            | 3 ++-
 atuin-client/src/record/sqlite_store.rs | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/atuin-client/src/database.rs b/atuin-client/src/database.rs
index c4b45302..29006d59 100644
--- a/atuin-client/src/database.rs
+++ b/atuin-client/src/database.rs
@@ -130,7 +130,8 @@ pub async fn new(path: impl AsRef<Path>) -> Result<Self> {
         }
 
         let opts = SqliteConnectOptions::from_str(path.as_os_str().to_str().unwrap())?
-            .journal_mode(SqliteJournalMode::Wal)
+            .journal_mode(SqliteJournalMode::Memory)
+            .synchronous(sqlx::sqlite::SqliteSynchronous::Off)
             .create_if_missing(true);
 
         let pool = SqlitePoolOptions::new().connect_with(opts).await?;
diff --git a/atuin-client/src/record/sqlite_store.rs b/atuin-client/src/record/sqlite_store.rs
index db709f20..eaed6f7a 100644
--- a/atuin-client/src/record/sqlite_store.rs
+++ b/atuin-client/src/record/sqlite_store.rs
@@ -37,7 +37,8 @@ pub async fn new(path: impl AsRef<Path>) -> Result<Self> {
         }
 
         let opts = SqliteConnectOptions::from_str(path.as_os_str().to_str().unwrap())?
-            .journal_mode(SqliteJournalMode::Wal)
+            .journal_mode(SqliteJournalMode::Memory)
+            .synchronous(sqlx::sqlite::SqliteSynchronous::Off)
             .create_if_missing(true);
 
         let pool = SqlitePoolOptions::new().connect_with(opts).await?;
-- 
2.42.0