From: Oleg Broytman Date: Thu, 24 Dec 2015 14:21:11 +0000 (+0300) Subject: Speedup SQLite connection X-Git-Tag: 0.0.3~5 X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=83f695f2450870843d3c0b764f826a66f3a1ea68;p=m_librarian.git Speedup SQLite connection But increase the risk of loosing data. --- 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):