Set some PRAGMAs to optimize the history database.
Enable write-ahead-logging and reduce the synchronous level to NORMAL. This should reduce the number of writes to disk and avoid some of the hangs users are experiencing. Resolves #3507. Resolves #2930 (optimistically, reopen if not fixed). See https://sqlite.org/pragma.html and https://www.sqlite.org/wal.html.
This commit is contained in:
parent
d62cb58f7d
commit
9d5beff937
@ -115,6 +115,11 @@ def init(db_path):
|
|||||||
raise SqliteError("Failed to open sqlite database at {}: {}"
|
raise SqliteError("Failed to open sqlite database at {}: {}"
|
||||||
.format(db_path, error.text()), error)
|
.format(db_path, error.text()), error)
|
||||||
|
|
||||||
|
# Enable write-ahead-logging and reduce disk write frequency
|
||||||
|
# see https://sqlite.org/pragma.html and issues #2930 and #3507
|
||||||
|
Query("PRAGMA journal_mode=WAL").run()
|
||||||
|
Query("PRAGMA synchronous=NORMAL").run()
|
||||||
|
|
||||||
|
|
||||||
def close():
|
def close():
|
||||||
"""Close the SQL connection."""
|
"""Close the SQL connection."""
|
||||||
|
Loading…
Reference in New Issue
Block a user