Database locking redux
Dec 30, 2010 23:36:09 GMT -5
Post by David den Haring on Dec 30, 2010 23:36:09 GMT -5
Has anyone tried updating the version of SQLite in their Run BASIC installation?
I did it today and tested it using the Buggs example project. In other words, I just did some quick and dirty testing.
Why would you want to do this? Well, you'd be moving from version 3.4.0 to 3.7.4. Among other new features, you get WAL (Write Ahead Logging). Here's why WAL is wonderful:
You can read more at sqlite.org/wal.html
I'm wondering if this will help with the Run Basic SQLite locking issues. I haven't done enough testing yet to know for sure if the upgrade will work reliably with Run Basic.
In any case, here are the steps to upgrade SQLite and change your databases to use WAL transactions:
Switching your database to WAL is persistent. Doing a VACUUM, however, will automatically switch it back to the default DELETE transaction mode.
I'm interested to see how more complicated apps fair with databases running in the WAL journal mode. I'm going to keep testing myself.
I did it today and tested it using the Buggs example project. In other words, I just did some quick and dirty testing.
Why would you want to do this? Well, you'd be moving from version 3.4.0 to 3.7.4. Among other new features, you get WAL (Write Ahead Logging). Here's why WAL is wonderful:
- 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.
You can read more at sqlite.org/wal.html
I'm wondering if this will help with the Run Basic SQLite locking issues. I haven't done enough testing yet to know for sure if the upgrade will work reliably with Run Basic.
In any case, here are the steps to upgrade SQLite and change your databases to use WAL transactions:
- Get the latest versions of sqlite3.dll, sqlite3.def and sqlite3.exe from the sqlite website. Backup your current files and copy the new ones into your Run BASIC folder.
- Use the PRAGMA command to change the journal mode. The command is PRAGMA journal_mode=wal.
Switching your database to WAL is persistent. Doing a VACUUM, however, will automatically switch it back to the default DELETE transaction mode.
I'm interested to see how more complicated apps fair with databases running in the WAL journal mode. I'm going to keep testing myself.