I have tasks running every few seconds that need to read and write to my sqlite3 database.
To avoid starting python interpreters and opening the database for each task, the processes are always running and the sqlite3 connection is never closed.
To improve performance and allow more concurrent reads, I'm using WAL mode.
The problem is that "checkpoints" are never made because the connections are not closed so my wal file is growing and I have bad performance. The first value returned by PRAGMA wal_checkpoint(TRUNCATE); is 1, indicating it was blocked from completing.
What is the standard way to have multiple processes always running on the same database?
- is not closing connections ok if we don't use WAL mode?
- should I regularly close and reopen connections? (eg with a timer)
- is there a way to make
wal_checkpointexecute? (I don't know why they are blocked)
Any other solution is welcome!
from How should sqlite3 be used in a "steady state"?
No comments:
Post a Comment