From 5bdd52df2581a408426fa7ace336b56cea550c49 Mon Sep 17 00:00:00 2001 From: Rhet Turnbull Date: Thu, 10 Feb 2022 22:32:22 -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 d7bb4166..a3ac6f20 100644 --- a/osxphotos/export_db.py +++ b/osxphotos/export_db.py @@ -649,6 +649,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):