tirkarthi opened a new issue, #57427:
URL: https://github.com/apache/airflow/issues/57427

   ### Apache Airflow version
   
   main (development)
   
   ### If "Other Airflow 2/3 version" selected, which one?
   
   _No response_
   
   ### What happened?
   
   generate_dag_with_latest_run_query queries all dagruns irrespective of the 
dag ids accessible causing the query to be expensive. This causes grouping of 
all dagruns to get the latest dagrun to be thrown away later. Since 
`readable_dags_filter.value` which has the permitted dag_ids can be passed to 
this function thus grouping dagruns for only accessible dag ids. This will help 
in deployments where some users have access to only few dag ids but still 
resulting in queries where group by is performed for all dagruns.
   
   ### What you think should happen instead?
   
   _No response_
   
   ### How to reproduce
   
   1. Generate 100 dags with 100 dagrun per dag.
   2. Create a user with auth manager configured where the user can access only 
few dag ids.
   3. Visit the dags list page.
   4. generate_dag_with_latest_run_query subquery referenced as mrq groups by 
all dagruns of all dagids.
   
   ```
   (SELECT dag_run.dag_id AS dag_id, max(dag_run.id) AS max_dag_run_id FROM 
dag_run GROUP BY dag_run.dag_id) AS mrq
   ```
   
   ### Operating System
   
   Ubuntu 20.04
   
   ### Versions of Apache Airflow Providers
   
   _No response_
   
   ### Deployment
   
   Virtualenv installation
   
   ### Deployment details
   
   _No response_
   
   ### 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]

Reply via email to