vchiapaikeo commented on PR #40695:
URL: https://github.com/apache/airflow/pull/40695#issuecomment-2225971152

   So I tried to fix [the 
query](https://github.com/apache/airflow/blob/main/airflow/models/trigger.py#L306-L314)
 (which I thought would be a better, simpler solution) to use a left join but 
actually, Postgres does not allow row locks with a left join.
   
   On our sandbox MySQL instance where we have ~3M task_instances, this is 
producing the correct explain plan now. 
   
   Full table scan on trigger table instead of task_instance table:
   
   
![airflow-db](https://github.com/user-attachments/assets/75080cc2-5e0a-449c-978e-577ae0a3e83c)
   
   Previously, it was doing the full table scan on the task_instance table:
   
   
![airflow-db-prev](https://github.com/user-attachments/assets/7afc0fba-1f61-4322-a0f8-9244c367ed04)
   


-- 
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]

Reply via email to