pierrejeambrun opened a new issue, #62027: URL: https://github.com/apache/airflow/issues/62027
### Body Similarly to https://github.com/apache/airflow/issues/62025 On big installation the "get_task_instances" endpoint to list all the dagruns in the UI is taking a long time to return a response. The critical part of the code is the actual db query. Most likely due to the number of joins creating rows explosion. We need to optimize the query, most likely by double checking the eager loading options and verify that there is no row explosion cause by a wrong option (joinedload vs selectinload). Also we can add `load_only` to limit the number of columns selected in each joins. https://github.com/apache/airflow/blob/4e75919198be6b8e4d3ac52656a9b74e0e73b097/airflow-core/src/airflow/api_fastapi/core_api/routes/public/task_instances.py#L483-L533 Also needs investigation to check if an extra index could help. https://github.com/user-attachments/assets/6cfc5f15-65d1-4a89-bd5c-5e1ff5cb5c99 ### Committer - [x] I acknowledge that I am a maintainer/committer of the Apache Airflow project. ### Committer - [x] I acknowledge that I am a maintainer/committer of the Apache Airflow project. -- 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]
