From cb11967eac0fc26e1c49aecc0f8ef99cbb685964 Mon Sep 17 00:00:00 2001 From: Rhet Turnbull Date: Thu, 10 Feb 2022 22:36:35 -0800 Subject: [PATCH] Implement #629, sqlite performance optimizatons for export db --- osxphotos/export_db.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/osxphotos/export_db.py b/osxphotos/export_db.py index 66b524d3..3e5860a6 100644 --- a/osxphotos/export_db.py +++ b/osxphotos/export_db.py @@ -637,6 +637,14 @@ class ExportDB(ExportDB_ABC): else: self.was_upgraded = () self.version = OSXPHOTOS_EXPORTDB_VERSION + + # turn on performance optimizations + c = conn.cursor() + c.execute("PRAGMA journal_mode=WAL;") + c.execute("PRAGMA synchronous=NORMAL;") + c.execute("PRAGMA cache_size=-100000;") + c.execute("PRAGMA temp_store=MEMORY;") + return conn def _get_db_connection(self, dbfile):