Skip to content

Commit 77253e3

Browse files
chrisburrclaude
andcommitted
feat: Add database indices to improve FTS3Agent performance
Add composite indices on (lastUpdate, assignment) for both Jobs and Operations tables in FTS3DB to optimize query performance. In LHCb these indices improve FTS3Agent cycle times from ~1400s to ~1000s. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 0a4f397 commit 77253e3

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/DIRAC/DataManagementSystem/DB/FTS3DB.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
Enum,
1717
Float,
1818
ForeignKey,
19+
Index,
1920
Integer,
2021
MetaData,
2122
SmallInteger,
@@ -85,6 +86,7 @@
8586
Column("error", String(2048)),
8687
Column("status", Enum(*FTS3Job.ALL_STATES), server_default=FTS3Job.INIT_STATE, index=True),
8788
Column("assignment", String(255), server_default=None),
89+
Index("idx_jobs_lastupdate_assignment", "lastUpdate", "assignment"),
8890
mysql_engine="InnoDB",
8991
)
9092

@@ -110,6 +112,7 @@
110112
Column("error", String(1024)),
111113
Column("type", String(255)),
112114
Column("assignment", String(255), server_default=None),
115+
Index("idx_operations_lastupdate_assignment", "lastUpdate", "assignment"),
113116
mysql_engine="InnoDB",
114117
)
115118

0 commit comments

Comments
 (0)