manipatnam opened a new pull request, #62062: URL: https://github.com/apache/airflow/pull/62062
Optimize task_reschedule_count query with EXISTS check For customers with huge number of TaskReschedule rows (from heavy sensor usage), the unconditional COUNT query on every task execution causes performance issues. This PR adds an EXISTS check before the COUNT query. The EXISTS check returns instantly for tasks without reschedule records (99%+ of tasks), avoiding expensive operations on the TaskReschedule table. Sensors and tasks rescheduled due to DAG load failures still get accurate counts. **Performance impact:** - Regular tasks: Single fast EXISTS query, no COUNT needed - Sensors with reschedules: EXISTS + COUNT -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
