github-actions[bot] opened a new pull request, #72944:
URL: https://github.com/apache/airflow/pull/72944

   * Reuse the explicit dag_run join on the previous-TI lookup
   
   The previous-TI query in ``get_previous_task_instance`` explicitly joins
   ``dag_run`` for the ``ORDER BY dag_run.logical_date`` and asked for a second
   ``joinedload(TI.dag_run)`` for hydration. ``TaskInstance.dag_run`` is already
   ``lazy="joined"`` on the mapper, so the eager-load actually attached a 
parallel
   ``JOIN dag_run AS dag_run_1`` next to the explicit join. Both joins pull the
   same rows over the same FK pair.
   
   Switch to ``contains_eager(TI.dag_run)`` so the eager-load reuses the 
explicit
   join instead of adding a second one, and add a regression that fails when the
   compiled SQL references ``dag_run`` more than once in the FROM clause.
   
   * Drop unused load_only import
   
   * Assert the eager-load claim by watching for stray dag_run SELECTs
   
   * Swap the stray-select capture for a request-level query count
   (cherry picked from commit d076a57dcb24303c69d8505ea4816417003ffb34)
   
   Co-authored-by: Pierre Jeambrun <[email protected]>


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