Skip to content

Commit 815b1f8

Browse files
authored
edk2toollib.database.edk2_db: Add env index to large tables
Most queries rely on a specific env value when generating results; this commit adds an index on the env column for the junction and instanced_inf tables as they get extremely large and index's here will improve performance when filtering on a specific env value.
1 parent e8eb612 commit 815b1f8

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

edk2toollib/database/edk2_db.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@
2626
)
2727
"""
2828

29+
CREATE_JUNCTION_INDEX = """
30+
CREATE INDEX IF NOT EXISTS junction_idx
31+
ON junction (env);
32+
"""
33+
2934
class Edk2DB:
3035
"""A SQLite3 database manager for a EDKII workspace.
3136
@@ -97,6 +102,7 @@ def parse(self, env: dict) -> None:
97102
not exist, and a row is added for each call of this command.
98103
"""
99104
self.connection.execute(CREATE_JUNCTION_TABLE)
105+
self.connection.execute(CREATE_JUNCTION_INDEX)
100106
id = str(uuid.uuid4().hex)
101107

102108
# Create all tables

0 commit comments

Comments
 (0)