Skip to content

Commit

Permalink
Try restoring SQLite pragmas
Browse files Browse the repository at this point in the history
Closes #3329

This restores configurations we had prior to migrating to rusqlite.
  • Loading branch information
hdevalence committed Nov 15, 2023
1 parent d24587c commit 58db0cc
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions crates/view/src/storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,10 @@ impl Storage {
OpenFlags::default() & !OpenFlags::SQLITE_OPEN_URI,
)
.with_init(|conn| {
// "NORMAL" will be consistent, but maybe not durable -- this is fine,
// since all our data is being synced from the chain, so if we lose a dbtx,
// it's like we're resuming sync from a previous height.
conn.execute_batch("PRAGMA journal_mode=WAL; PRAGMA synchronous=NORMAL;")?;
// We use `prepare_cached` a fair amount: this is an overestimate of the number
// of cached prepared statements likely to be used.
conn.set_prepared_statement_cache_capacity(32);
Expand Down

0 comments on commit 58db0cc

Please sign in to comment.