sql: set PRAGMA synchronous=normal

It was set in `sqlx` code, but not in `rusqlite` mode.

synchronous=FULL makes benchmark that write to the database a lot slower.
This commit is contained in:
link2xt
2021-04-25 23:12:37 +03:00
parent 143c5e6249
commit eef51f064a

View File

@@ -124,9 +124,12 @@ impl Sql {
*self.pool.write().await = Some(Self::new_pool(dbfile.as_ref(), readonly)?);
if !readonly {
// journal_mode is persisted, it is sufficient to change it only for one handle.
self.with_conn(move |conn| {
// journal_mode is persisted, it is sufficient to change it only for one handle.
conn.pragma_update(None, "journal_mode", &"WAL".to_string())?;
// Default synchronous=FULL is much slower. NORMAL is sufficient for WAL mode.
conn.pragma_update(None, "synchronous", &"NORMAL".to_string())?;
Ok(())
})
.await?;