mirror of
https://github.com/chatmail/core.git
synced 2026-05-19 23:06:32 +03:00
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:
@@ -124,9 +124,12 @@ impl Sql {
|
|||||||
*self.pool.write().await = Some(Self::new_pool(dbfile.as_ref(), readonly)?);
|
*self.pool.write().await = Some(Self::new_pool(dbfile.as_ref(), readonly)?);
|
||||||
|
|
||||||
if !readonly {
|
if !readonly {
|
||||||
// journal_mode is persisted, it is sufficient to change it only for one handle.
|
|
||||||
self.with_conn(move |conn| {
|
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())?;
|
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(())
|
Ok(())
|
||||||
})
|
})
|
||||||
.await?;
|
.await?;
|
||||||
|
|||||||
Reference in New Issue
Block a user