Concurrency not working
(1) By tripppp on 2021-05-25 18:20:13 [link] [source]
I am using SQLite 3 with PHP 7 + NGINX.
It appears the write-ahead log is supposed to write to temporary files when the database is locked, to allow for concurrency.
However, when I try to write to the database simultaneously, I am greeted with the "database is locked" error.
No temporary files are created.
Am I supposed to enable the write-ahead log? Is it disabled by default?
If so, how do I enable it
(2) By Larry Brasfield (larrybr) on 2021-05-25 18:38:55 in reply to 1 [link] [source]
I recommend study of the main WAL doc.
Your thread title needs an edit. Yes, WAL mode is not the default. It works well when selected. See the doc for ways to do that, including compile-time options.
(4) By tripppp on 2021-05-25 18:46:32 in reply to 2 [link] [source]
So I assume I would only have to activate this once?
Are there any other concurrency-related features that I need to activate - that aren't enabled by default?
(5) By Larry Brasfield (larrybr) on 2021-05-25 18:53:28 in reply to 4 [link] [source]
No need to assume; see section "3.3 Persistence of WAL mode".
I hesitate to answer your 2nd question as both "concurrency-related features" and "default" are somewhat nebulous concepts for the SQLite project. There are whole doc pages on threading provisions and behavior, and what features get into a build with no options specified is a set that changes over time.
(3) By Gerry Snyder (GSnyder) on 2021-05-25 18:39:53 in reply to 1 [source]
"Writers merely append new content to the end of the WAL file. Because writers do nothing that would interfere with the actions of readers, writers and readers can run at the same time. However, since there is only one WAL file, there can only be one writer at a time."
From Section 2.2 of: https://sqlite.org/wal.html#activating_and_configuring_wal_mode