nclaeys opened a new issue, #59598: URL: https://github.com/apache/airflow/issues/59598
### Apache Airflow version Other Airflow 3 version (please specify below) ### If "Other Airflow 3 version" selected, which one? 3.1.3 ### What happened? When browsing the Airflow UI and looking at the tasks tab, it triggers n+1 queries for every task in your dag. If your dag has 200+ tasks, it does 200+ queries which should not be the case. The first 30 might succeed but afterwards the calls fail due to a sqlalchemy timeout. problematic UI path: <airflowBaseUrl>/airflow/dags/<some-dag>/tasks UI: <img width="1838" height="993" alt="Image" src="https://github.com/user-attachments/assets/6a8da788-b4cd-4092-a8fc-81b83393bd5c" /> Logs of the api-server where only 1 user is using it: [api-server.log](https://github.com/user-attachments/files/24233688/api-server.log) ### What you think should happen instead? Visualizing and working with dags that have many tasks should work. The UI should not do a call for every task in the dag as that can never scale. Redesign of parts of the UI might be needed. I saw in the issues that work has been done to fix n+1 queries (https://github.com/apache/airflow/issues/57561), but it seems this path has been missed. ### How to reproduce Create a dag with 200 tasks in it and make sure there are a couple of dagruns (5 or so). Go to the dag (gridview) and then click on tasks tab on the right panel. See previous screenshot. Check the logs and you will see that 200 calls are triggered to fetch task instances for every task in the dag. ### Operating System ubuntu ### Versions of Apache Airflow Providers apache-airflow==3.1.3 apache-airflow-core==3.1.3 apache-airflow-providers-cncf-kubernetes==10.6.0 apache-airflow-providers-common-compat==1.9.0 apache-airflow-providers-common-io==1.6.5 apache-airflow-providers-common-sql==1.29.0 apache-airflow-providers-openlineage==2.9.0 apache-airflow-providers-postgres==6.4.1 apache-airflow-providers-smtp==2.3.2 apache-airflow-providers-standard==1.9.2 apache-airflow-task-sdk==1.1.3 ### Deployment Other Docker-based deployment ### Deployment details We deploy airflow on kubernetes similarly to the officical Airflow helm chart but than using our own operator. ### Anything else? _No response_ ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [x] I agree to follow this project's [Code of Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md) -- 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]
