Skip to content

Commit

Permalink
Prevent sequential scan of task instance table (#8014)
Browse files Browse the repository at this point in the history
The exact dag_id is known so no need to perform a like here which caused
a sequential scan.
  • Loading branch information
robinedwards committed Mar 31, 2020
1 parent 2503857 commit cfc0d6c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion airflow/models/dag.py
Original file line number Diff line number Diff line change
Expand Up @@ -978,7 +978,7 @@ def clear(
conditions = []
for dag in self.subdags + [self]:
conditions.append(
TI.dag_id.like(dag.dag_id) &
(TI.dag_id == dag.dag_id) &
TI.task_id.in_(dag.task_ids)
)
tis = tis.filter(or_(*conditions))
Expand Down

0 comments on commit cfc0d6c

Please sign in to comment.