Skip to content

Commit

Permalink
dagrun, next_dagruns_to_examine, add MySQL index hint (#27821)
Browse files Browse the repository at this point in the history
* dagrun, next_dagruns_to_examine, add MySQL index hint

* resolve static check errors
  • Loading branch information
michaelmicheal committed Nov 25, 2022
1 parent f0820e8 commit 5e45cb0
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions airflow/models/dagrun.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ def next_dagruns_to_examine(
# TODO: Bake this query, it is run _A lot_
query = (
session.query(cls)
.with_hint(cls, "USE INDEX (idx_dag_run_running_dags)", dialect_name="mysql")
.filter(cls.state == state, cls.run_type != DagRunType.BACKFILL_JOB)
.join(DagModel, DagModel.dag_id == cls.dag_id)
.filter(DagModel.is_paused == false(), DagModel.is_active == true())
Expand Down

0 comments on commit 5e45cb0

Please sign in to comment.