Skip to content

Commit

Permalink
set sqlite PRAGMAs to improve performance
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-codecov committed Jul 29, 2024
1 parent c0a4b65 commit e1ceeb4
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/report/sqlite/report_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,14 @@ pub struct SqliteReportBuilder {
impl SqliteReportBuilder {
fn new_with_rng(filename: PathBuf, rng: StdRng) -> Result<SqliteReportBuilder> {
let conn = open_database(&filename)?;
// Trust the operating system to perform writes successfully
conn.pragma_update(None, "synchronous", "OFF")?;

// Don't keep a transaction journal; if we need to roll back, it's unrecoverable
conn.pragma_update(None, "journal_mode", "OFF")?;

// Allow SQLite to hold more database disk pages in memory
conn.pragma_update(None, "cache_size", "-200000")?;
Ok(SqliteReportBuilder {
filename,
conn,
Expand Down

0 comments on commit e1ceeb4

Please sign in to comment.