From 83f695f2450870843d3c0b764f826a66f3a1ea68 Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Thu, 24 Dec 2015 17:21:11 +0300 Subject: [PATCH] Speedup SQLite connection But increase the risk of loosing data. --- m_librarian/db.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/m_librarian/db.py b/m_librarian/db.py index 6888ab8..9a5eb0a 100755 --- a/m_librarian/db.py +++ b/m_librarian/db.py @@ -40,7 +40,15 @@ if not db_uri: db_uri = 'sqlite://%s' % db_file.replace(os.sep, '/') -sqlhub.processConnection = connectionForURI(db_uri) + +sqlhub.processConnection = connection = connectionForURI(db_uri) + +if connection.dbName == 'sqlite': + # Speedup SQLite connection + connection.query("PRAGMA synchronous=OFF") + connection.query("PRAGMA count_changes=OFF") + connection.query("PRAGMA journal_mode=MEMORY") + connection.query("PRAGMA temp_store=MEMORY") class Author(SQLObject): -- 2.39.2