From 95c6c7581b21c252cd05ba12e406f168362c58c1 Mon Sep 17 00:00:00 2001 From: Jussi Saurio Date: Thu, 7 Aug 2025 13:05:04 +0300 Subject: [PATCH] bench/insert: use PRAGMA synchronous=full synchronous=FULL means WAL is fsynced on every commit, which is what we also do. however we do not do the padding to sector alignment that sqlite does (see #2450), which makes sqlite do more work than we do. --- core/benches/benchmark.rs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/core/benches/benchmark.rs b/core/benches/benchmark.rs index 587a972cc..a23493fce 100644 --- a/core/benches/benchmark.rs +++ b/core/benches/benchmark.rs @@ -545,9 +545,25 @@ fn bench_insert_rows(criterion: &mut Criterion) { let temp_dir = tempfile::tempdir().unwrap(); let db_path = temp_dir.path().join("bench.db"); let sqlite_conn = rusqlite::Connection::open(db_path).unwrap(); + sqlite_conn + .pragma_update(None, "synchronous", "FULL") + .unwrap(); sqlite_conn .pragma_update(None, "journal_mode", "WAL") .unwrap(); + let journal_mode = sqlite_conn + .pragma_query_value(None, "journal_mode", |row| row.get::<_, String>(0)) + .unwrap(); + assert_eq!(journal_mode.to_lowercase(), "wal"); + let synchronous = sqlite_conn + .pragma_query_value(None, "synchronous", |row| row.get::<_, String>(0)) + .unwrap(); + assert_eq!(synchronous.to_lowercase(), "full"); + + // Create test table + sqlite_conn + .execute("CREATE TABLE test (id INTEGER, value TEXT)", []) + .unwrap(); sqlite_conn .pragma_update(None, "locking_mode", "EXCLUSIVE") .unwrap();