Skip to content

Commit 7f3d6a2

Browse files
committed
Add indices for efficient sorting by timestamp and filtering
1 parent a38868b commit 7f3d6a2

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

preciceprofiling/merge.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,11 @@ def createProfilingDB(con: sqlite3.Connection) -> sqlite3.Cursor:
125125
return cur
126126

127127

128+
def createIndices(con: sqlite3.Connection):
129+
con.execute("CREATE INDEX identity ON events (pid, rank)")
130+
con.execute("CREATE INDEX tsorder ON events (ts ASC)")
131+
132+
128133
@cache
129134
def addOrFetchParticipant(cur: sqlite3.Cursor, name: str, size: int):
130135
cur.execute(
@@ -471,6 +476,7 @@ def mergeCommand(files, outfile, align):
471476

472477
# commit and tidy up
473478
con.commit()
479+
createIndices(con)
474480
con.execute("VACUUM")
475481
con.close()
476482

0 commit comments

Comments
 (0)