fix: Add missing indices to PilotAgentsDB and JobDB#8463
Open
chrisburr wants to merge 2 commits intoDIRACGrid:integrationfrom
Open
fix: Add missing indices to PilotAgentsDB and JobDB#8463chrisburr wants to merge 2 commits intoDIRACGrid:integrationfrom
chrisburr wants to merge 2 commits intoDIRACGrid:integrationfrom
Conversation
…Agents SiteDirector.countPilots() filters on these three columns every scheduling cycle. The existing Statuskey index has GridSite as the leading column and does not cover Queue, resulting in a full table scan.
WorkflowTasks.updateTransformationReservedTasks() looks up jobs by JobName via SELECT JobID FROM Jobs WHERE JobName IN (...). Without an index this requires a full table scan. Also benefits dstat.py and the REST API job-name lookups.
4196a30 to
0ad5ac6
Compare
aldbr
approved these changes
Feb 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two hot-path queries are doing full table scans due to missing indices:
PilotAgentsDB —
SiteDirector.countPilots()filters on(DestinationSite, Queue, Status)every scheduling cycle. The existingStatuskeyindex is(GridSite, DestinationSite, Status)which doesn't coverQueueand has the wrong leading column for this query. A compositeidx_dest_queue_statusindex is added.JobDB —
WorkflowTasks.updateTransformationReservedTasks()callsgetJobs({"JobName": jobNames}), which doesSELECT JobID FROM Jobs WHERE JobName IN (...).JobNamehad no index at all, causing a full table scan. Also hit bydstat.pyand the REST API. AJobNameindex is added.Both are pure schema changes to the
.sqldefinition files. For existing deployments the schema change only takes effect on newly created tables (__initializeDBskips tables that already exist). Production DBs need a one-offALTER TABLEto add the indices.BEGINRELEASENOTES
*WorkloadManagement
FIX: Add composite (DestinationSite, Queue, Status) index to PilotAgents table for SiteDirector.countPilots()
FIX: Add JobName index to Jobs table for TransformationSystem and monitoring lookups
ENDRELEASENOTES