pierrejeambrun commented on code in PR #62160:
URL: https://github.com/apache/airflow/pull/62160#discussion_r2841980541


##########
airflow-core/src/airflow/api_fastapi/common/db/dag_runs.py:
##########
@@ -52,3 +52,14 @@ def eager_load_dag_run_for_validation() -> 
tuple[LoaderOption, ...]:
         .joinedload(DagVersion.bundle),
         joinedload(DagRun.dag_run_note),
     )
+
+
+def eager_load_dag_run_for_list() -> tuple[LoaderOption, ...]:
+    return (
+        joinedload(DagRun.dag_model),
+        joinedload(DagRun.dag_run_note),
+        joinedload(DagRun.created_dag_version)
+        .joinedload(DagVersion.bundle),
+        joinedload(DagRun.created_dag_version)
+        .joinedload(DagVersion.dag_model),

Review Comment:
   Can you explain the motivation here?
   
   We're not eager loading TI and TIH for `dag_versions` is that it? 
   
   This wasn't triggering any N+1 queries at serialization time (dag_versions) 
since TI and TIH were eager loaded there, so I'm not sure this will help. Also 
if you take a look at the tests, you will see that there is a number of  db 
queries guards, making sure there is no N+1 queries emitted.
   
   Did it make an improvement on your end?
   
   There is a double join statement  on ` 
joinedload(DagRun.created_dag_version)`  now



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