This is an automated email from the ASF dual-hosted git repository.
ash pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 134b5551db Adding mysql index hint to use index on task_instance.state
in critical section query (#25673)
134b5551db is described below
commit 134b5551db67f17b4268dce552e87a154aa1e794
Author: Michael Petro <[email protected]>
AuthorDate: Fri Aug 12 07:28:55 2022 -0400
Adding mysql index hint to use index on task_instance.state in critical
section query (#25673)
---
airflow/jobs/scheduler_job.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/airflow/jobs/scheduler_job.py b/airflow/jobs/scheduler_job.py
index 98ae383162..e066a77069 100644
--- a/airflow/jobs/scheduler_job.py
+++ b/airflow/jobs/scheduler_job.py
@@ -302,6 +302,7 @@ class SchedulerJob(BaseJob):
# and the dag is not paused
query = (
session.query(TI)
+ .with_hint(TI, 'USE INDEX (ti_state)', dialect_name='mysql')
.join(TI.dag_run)
.filter(DR.run_type != DagRunType.BACKFILL_JOB, DR.state ==
DagRunState.RUNNING)
.join(TI.dag_model)