3 ms·
SQLite is really great database for mobile applications, where concurrency can make a massive difference in how responsive the app is. Just as one example, ima
by matharmin 3y ago
SQLite is really great database for mobile applications, where concurrency can make a massive difference in how responsive the app is.
Just as one example, imagine a mobile app that does a bulk data download, and needs to persist it all to the local database in a single transaction for consistency purposes. This transaction can take a couple of seconds, or maybe a minute of you're working with millions of rows.
Now without concurrency, your database is locked for the entire transaction, and this may block any user actions.
With WAL, you can at least continue doing reads during this transaction.
With BEGIN CONCURRENT, the user may be able to continue most actions, as long as it doesn't touch the same set of data.
Now there are other ways of solving this problem: use smaller transactions and different mechanisms to ensure consistency. Or use separate databases if you can structure your data that way. But BEGIN CONCURRENT can be a nice solution without having to restructure the data completely.
Now these data volumes may be extreme, but even with "background" transaction taking in the order of a second can have an impact on how responsive the app feels to the user.