Skip to content
  • Jamie Tanna's avatar
    perf: allow concurrent read/write to the database · 41fb7c8e
    Jamie Tanna authored
    A very common issue folks with SQLite run into is that concurrent
    read/writes can return `SQLITE_BUSY`s.
    
    Via [0], [1] and best practices used across the industry, we can enable
    the Write Ahead Log (WAL) which makes it possible to concurrently read
    and write.
    
    This requires we provide a way to manage the PRAGMAs that SQLite needs
    to use to enable this functionality, as well as a few options via [0]
    I've not tested too much without, but with them seems like it's probably
    OK.
    
    This also resolves future issues we'll see when trying to write a large
    amount of data to the database while reading+writing Policy Violations.
    
    Closes #404.
    
    [0]: https://blog.pecar.me/sqlite-prod
    [1]: https://www.jvt.me/posts/2022/01/20/go-append-querystring/
    41fb7c8e