SQLite Concurrency Issue

[email protected] ("David E. Wheeler")
Newsgroups perl.dbi.users
Message-ID <[email protected]>
My fellow database gurus,

I love SQLite, but an issue with concurrency is driving me absolutely batshit.

I have a program that runs every few minutes, updating an SQLite database from feeds. There can be some overlap in the runtime: a new instance may start while a previous instance is still running. In such a case, I nearly always get the dreaded "database is locked" error -- SQLITE_BUSY.

Here's what I've done to try to avoid this error:

* sqlite_use_immediate_transaction => 1
* PRAGMA journal_mode = WAL
* $dbh->sqlite_busy_timeout(60_000);

None of these has made a difference. Now, I recognize that there can be some lock contention, but I certainly would think that one process would try to wait for a bit for a lock to release before it gave up the ghost. But when I run this stuff, it fails *very* quickly -- the busy timeout obviously is not being used.

So my question is, what other tactics can be used to improve the lock concurrency situation with SQLite? I understand that there have to be some pretty strong locks, but I'm perfectly happy for one process to wait for a lock to be freed. Why doesn't it just wait? It fails instantly!

Or am I going to have to use PostgreSQL?

Frustratedly,

David
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.