Skip to content

Conversation

@sortega
Copy link
Contributor

@sortega sortega commented Jan 21, 2026

Add index ti_dag_version_id on task_instance.dag_version_id column to improve query performance.

The dag_version_id column was added in migration 0047_3_0_0_add_dag_versioning.py but no index was created, causing full table scans when filtering or joining on this column. This affects:

  • UI grid endpoint (/ui/dags/{dag_id}/grid/...) filtering task instances by dag_version_id
  • Any query joining task_instance with dag_version

Note on MySQL: The downgrade skips dropping the index on MySQL because MySQL requires an index on FK columns. Since dag_version_id has a FK constraint, MySQL will keep using the index for the FK.

closes #60883


Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

Generated-by: Claude Code following the guidelines


🤖 Drafted with Claude Code

Add index ti_dag_version_id on task_instance.dag_version_id column
to improve query performance. The column was added in migration 0047
but no index was created, causing full table scans when filtering
by dag_version_id.

closes apache#60883
@sortega sortega force-pushed the sortega/add-index-ti-dag-version-id branch from db30951 to 55c9004 Compare January 22, 2026 11:09
@sortega sortega force-pushed the sortega/add-index-ti-dag-version-id branch from 55c9004 to ebb317d Compare January 22, 2026 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Avoid full table scan on /structure/{dag_id}

1 participant