Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set sqlite PRAGMAs to improve performance #13

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading