kaxil commented on code in PR #67217:
URL: https://github.com/apache/airflow/pull/67217#discussion_r3455857724


##########
airflow-core/src/airflow/jobs/scheduler_job_runner.py:
##########
@@ -648,6 +648,7 @@ def _executable_task_instances_to_queued(self, max_tis: 
int, session: Session) -
                     ranked_query.c.map_index_for_ordering,
                 )
                 .options(selectinload(TI.dag_model))
+                .options(selectinload(TI.dag_version))

Review Comment:
   I think we can still narrow the read volume inside `FOR UPDATE SKIP LOCKED` 
by column-scoping the eager-load: 
`.options(selectinload(TI.dag_version).load_only(DagVersion.version_data))`. 
The PK is auto-included by SQLAlchemy, and this is the documented at 
https://docs.sqlalchemy.org/en/20/orm/queryguide/columns.html#using-load-only-on-related-objects-and-collections
 . That should drop the second `SELECT` from 8 columns to 2 (`id`, 
`version_data`).
   
   



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