At the WWDC 2013 session '207: What's New in Core Data', they mention that you can enable SQLite WAL by passing an options dictionary when adding a persistent store:
@{ NSSQLitePragmasOption: @"journal_mode = WAL" }
(which is available on iOS4+ and will be the default for future iOS versions).
I'm wondering whether this would generally be a good thing to enable in my app for earlier iOS versions too.
I've consulted the SQLite page about write ahead logging and the disadvantages they mention, most of them seem not to apply to iOS apart from:
- WAL might be very slightly slower (perhaps 1% or 2% slower) than the traditional rollback-journal approach in applications that do mostly reads and seldom write.
pretty much all the advantages do sound like they'll probably be a benefit on iOS:
- WAL is significantly faster in most scenarios.
- WAL provides more concurrency as readers do not block writers and a writer does not block readers. Reading and writing can proceed concurrently.
- Disk I/O operations tends to be more sequential using WAL.
- WAL uses many fewer fsync() operations and is thus less vulnerable to problems on systems where the fsync() system call is broken.
I'm asuming (perhaps subject to doing some checks on my app to make sure it doesn't slow things down) that this would be a good thing to enable, but is there any downside I should watch for or any known issues?