diff --git a/rust/src/api/main.rs b/rust/src/api/main.rs index cb22af3..5dc05cd 100644 --- a/rust/src/api/main.rs +++ b/rust/src/api/main.rs @@ -107,9 +107,11 @@ async fn main() { )) .unwrap() .journal_mode(sqlx::sqlite::SqliteJournalMode::Wal) + .pragma("journal_size_limit", "67108864") + .pragma("mmap_size", "134217728") .synchronous(sqlx::sqlite::SqliteSynchronous::Normal) .busy_timeout(Duration::from_secs(15)) - .pragma("cache_size", "1000000000") + .pragma("cache_size", "2000") .optimize_on_close(true, None), ) .await diff --git a/rust/src/scraper/db.rs b/rust/src/scraper/db.rs index ff54e91..ce78efa 100644 --- a/rust/src/scraper/db.rs +++ b/rust/src/scraper/db.rs @@ -22,10 +22,13 @@ impl Db { .max_connections(1) .connect_with( SqliteConnectOptions::from_str(&format!("sqlite://{}", db_path))? + // https://fractaledmind.github.io/2023/09/07/enhancing-rails-sqlite-fine-tuning/ .journal_mode(sqlx::sqlite::SqliteJournalMode::Wal) + .pragma("journal_size_limit", "67108864") + .pragma("mmap_size", "134217728") .synchronous(sqlx::sqlite::SqliteSynchronous::Normal) .busy_timeout(Duration::from_secs(15)) - .pragma("cache_size", "1000000000") + .pragma("cache_size", "2000") .pragma("temp_store", "memory") .optimize_on_close(true, None), )