2 ms·
Presumably multiple readers are fine, with only multiple writers being an issue? I vaguely recall trying to use multiple threads to write to an SQLite DB some
by GordonS 7y ago
Presumably multiple readers are fine, with only multiple writers being an issue?
I vaguely recall trying to use multiple threads to write to an SQLite DB some years ago, and I think it actually locked the entire file for writes. I might remembering wrongly, but I think I switched to reader/writer locks in c# instead, and seeing a huge perf boost.
- lvh 7y agoWAL mode means readers do not block writers and a writer does not block readers. If it locked the entire database you likely weren’t using WAL.
- GordonS 7y agoI was definitely using WAL - I know I mentioned using reader/write locks, but that was so the C# locking mechanism worked the way I wanted; I realise that SQLite doesn't block readers on writes. My point, not well made :), was that a lightweight locking mechanism worked much faster than SQLite's file-based locking mechanism. This was on Windows, mind, so things might be very different on Linux.