From a6f7093baeb5360b3568149a837c537e926fe8b3 Mon Sep 17 00:00:00 2001 From: Doug Blank Date: Sat, 23 May 2015 10:27:49 -0400 Subject: [PATCH] Added indices on order_by fields --- gramps/plugins/database/dbapi.py | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/gramps/plugins/database/dbapi.py b/gramps/plugins/database/dbapi.py index 774a4bdda..436ba87d5 100644 --- a/gramps/plugins/database/dbapi.py +++ b/gramps/plugins/database/dbapi.py @@ -1490,7 +1490,9 @@ class DBAPI(DbWriteBase, DbReadBase, UpdateCallback, Callback): return list(key2table[obj_key].keys()) def transaction_begin(self, transaction): - ## FIXME + """ + Transactions are handled automatically by the db layer. + """ return def set_researcher(self, owner): @@ -2013,6 +2015,25 @@ class DBAPI(DbWriteBase, DbReadBase, UpdateCallback, Callback): order_by TEXT , blob TEXT );""") + ## Indices: + self.dbapi.execute("""CREATE INDEX IF NOT EXISTS + order_by ON person (order_by); + """) + self.dbapi.execute("""CREATE INDEX IF NOT EXISTS + order_by ON source (order_by); + """) + self.dbapi.execute("""CREATE INDEX IF NOT EXISTS + order_by ON citation (order_by); + """) + self.dbapi.execute("""CREATE INDEX IF NOT EXISTS + order_by ON media (order_by); + """) + self.dbapi.execute("""CREATE INDEX IF NOT EXISTS + order_by ON place (order_by); + """) + self.dbapi.execute("""CREATE INDEX IF NOT EXISTS + order_by ON tag (order_by); + """) def redo(self, update_history=True): ## FIXME