pierrejeambrun commented on code in PR #57500:
URL: https://github.com/apache/airflow/pull/57500#discussion_r2477544813
##########
airflow-core/src/airflow/api_fastapi/core_api/routes/public/dag_run.py:
##########
@@ -607,7 +621,16 @@ def get_list_dag_runs_batch(
{"dag_run_id": "run_id"},
).set_value([body.order_by] if body.order_by else None)
- base_query = select(DagRun).options(joinedload(DagRun.dag_model))
+ base_query = select(DagRun).options(
+ joinedload(DagRun.dag_model),
+ selectinload(DagRun.task_instances)
+ .joinedload(TaskInstance.dag_version)
+ .joinedload(DagVersion.bundle),
+ selectinload(DagRun.task_instances_histories)
+ .joinedload(TaskInstanceHistory.dag_version)
+ .joinedload(DagVersion.bundle),
+ joinedload(DagRun.dag_run_note),
+ )
Review Comment:
I took a look and the most important ones are there:
- DagRun → DagModel: DagModel.dag_id is PK; DagRun has
Index("idx_dag_run_dag_id").
- DagRun → TaskInstance: composite Index("ti_dag_run", dag_id, run_id)
exists.
- TaskInstance → DagVersion: DagVersion.id PK exists.
- DagRun → TaskInstanceHistory: Index("idx_tih_dag_run", dag_id, run_id)
exists.
- DagRun → DagRunNote: dag_run_id is PK, so indexed.
We're missing stuff in regards to DagVersion, but I don't think that's
critical for now. Indexes on `TaskInstance.dag_version_id`
`TaskInstanceHistory.dag_version_id` `DagVersion.bundle_name`. I guess we can
add them later if we want to.
Let me know if I should start another PR to add those.
--
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]