set sqlite PRAGMAs to improve performance #13
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
quick changes to SQLite pragmas to improve bulk insert performance:
journal_mode=OFF
: no transaction journal, we can't roll back (in SQLite). we can still "rollback" by just not persisting/exporting the SQLite database after failed processingcache_size=-200000
: set the SQLite page cache size to ~200MBsynchronous=OFF
: trust the filesystem to perform reads reliablyjournal_mode
andcache_size
together improve bulk insert speed for my 110mb test report by about a second.cache_size
increases the RAM usage, but it's capped. i chose 200MB arbitrarily but we can turn this knob later when running on real trafficwith a 200MB page cache, i found RAM usage topped off at ~150MB for my 110mb test report. profile data shows SQLite doesn't do any disk writes until the end when the transaction gets committed, and not a lot of time is spent waiting on disk IO overall. most of the time remaining is spent on index updates and such