]> git.sesse.net Git - nageru/blobdiff - db.cpp
Speed up the database writes a bit, especially when I/O is busy.
[nageru] / db.cpp
diff --git a/db.cpp b/db.cpp
index 9b0de352fda7bafb3ae8c107181325bdefca7508..c3e647cf46343885360c58007da9d970aabe80af 100644 (file)
--- a/db.cpp
+++ b/db.cpp
@@ -15,6 +15,9 @@ DB::DB(const std::string &filename)
        sqlite3_exec(db, R"(
                CREATE TABLE IF NOT EXISTS state (state BLOB);
        )", nullptr, nullptr, nullptr);  // Ignore errors.
+
+       sqlite3_exec(db, "PRAGMA journal_mode=WAL", nullptr, nullptr, nullptr);  // Ignore errors.
+       sqlite3_exec(db, "PRAGMA synchronous=NORMAL", nullptr, nullptr, nullptr);  // Ignore errors.
 }
 
 StateProto DB::get_state()