Skip to content

[v3-2-test] Reduce per-DAG queries during DAG serialization with bulk prefetch (#64929)#65208

Merged
ephraimbuddy merged 1 commit intov3-2-testfrom
backport-ef00040-v3-2-test
Apr 14, 2026
Merged

[v3-2-test] Reduce per-DAG queries during DAG serialization with bulk prefetch (#64929)#65208
ephraimbuddy merged 1 commit intov3-2-testfrom
backport-ef00040-v3-2-test

Conversation

@ephraimbuddy
Copy link
Copy Markdown
Contributor

Replaces 3 SELECTs per DAG in write_dag (update interval check, hash comparison, version fetch) with 2 bulk queries via a new _prefetch_dag_write_metadata classmethod. Also fixes DagCode.update_source_code to reuse the caller's session and eagerly loads dag_owner_links to prevent N+1 queries.

  • fixup! Reduce per-DAG queries during DAG serialization with bulk prefetch

  • fixup! fixup! Reduce per-DAG queries during DAG serialization with bulk prefetch

(cherry picked from commit ef00040)


Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

  • Read the Pull Request Guidelines for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
  • For fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
  • When adding dependency, check compliance with the ASF 3rd Party License Policy.
  • For significant user-facing changes create newsfragment: {pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.

…64929)

* Reduce per-DAG queries during DAG serialization with bulk prefetch

Replaces 3 SELECTs per DAG in write_dag (update interval check, hash
comparison, version fetch) with 2 bulk queries via a new
_prefetch_dag_write_metadata classmethod. Also fixes DagCode.update_source_code
to reuse the caller's session and eagerly loads dag_owner_links to prevent
N+1 queries.

* fixup! Reduce per-DAG queries during DAG serialization with bulk prefetch

* fixup! fixup! Reduce per-DAG queries during DAG serialization with bulk prefetch

(cherry picked from commit ef00040)
@ephraimbuddy ephraimbuddy merged commit ea24232 into v3-2-test Apr 14, 2026
196 of 216 checks passed
@ephraimbuddy ephraimbuddy deleted the backport-ef00040-v3-2-test branch April 14, 2026 15:00
vatsrahul1001 pushed a commit that referenced this pull request Apr 15, 2026
…64929) (#65208)

* Reduce per-DAG queries during DAG serialization with bulk prefetch

Replaces 3 SELECTs per DAG in write_dag (update interval check, hash
comparison, version fetch) with 2 bulk queries via a new
_prefetch_dag_write_metadata classmethod. Also fixes DagCode.update_source_code
to reuse the caller's session and eagerly loads dag_owner_links to prevent
N+1 queries.

* fixup! Reduce per-DAG queries during DAG serialization with bulk prefetch

* fixup! fixup! Reduce per-DAG queries during DAG serialization with bulk prefetch

(cherry picked from commit ef00040)
@vatsrahul1001 vatsrahul1001 added the type:bug-fix Changelog: Bug Fixes label Apr 15, 2026
@vatsrahul1001 vatsrahul1001 added this to the Airflow 3.2.1 milestone Apr 15, 2026
vatsrahul1001 pushed a commit that referenced this pull request Apr 15, 2026
…64929) (#65208)

* Reduce per-DAG queries during DAG serialization with bulk prefetch

Replaces 3 SELECTs per DAG in write_dag (update interval check, hash
comparison, version fetch) with 2 bulk queries via a new
_prefetch_dag_write_metadata classmethod. Also fixes DagCode.update_source_code
to reuse the caller's session and eagerly loads dag_owner_links to prevent
N+1 queries.

* fixup! Reduce per-DAG queries during DAG serialization with bulk prefetch

* fixup! fixup! Reduce per-DAG queries during DAG serialization with bulk prefetch

(cherry picked from commit ef00040)
vatsrahul1001 pushed a commit that referenced this pull request Apr 15, 2026
…64929) (#65208)

* Reduce per-DAG queries during DAG serialization with bulk prefetch

Replaces 3 SELECTs per DAG in write_dag (update interval check, hash
comparison, version fetch) with 2 bulk queries via a new
_prefetch_dag_write_metadata classmethod. Also fixes DagCode.update_source_code
to reuse the caller's session and eagerly loads dag_owner_links to prevent
N+1 queries.

* fixup! Reduce per-DAG queries during DAG serialization with bulk prefetch

* fixup! fixup! Reduce per-DAG queries during DAG serialization with bulk prefetch

(cherry picked from commit ef00040)
vatsrahul1001 pushed a commit that referenced this pull request Apr 15, 2026
…64929) (#65208)

* Reduce per-DAG queries during DAG serialization with bulk prefetch

Replaces 3 SELECTs per DAG in write_dag (update interval check, hash
comparison, version fetch) with 2 bulk queries via a new
_prefetch_dag_write_metadata classmethod. Also fixes DagCode.update_source_code
to reuse the caller's session and eagerly loads dag_owner_links to prevent
N+1 queries.

* fixup! Reduce per-DAG queries during DAG serialization with bulk prefetch

* fixup! fixup! Reduce per-DAG queries during DAG serialization with bulk prefetch

(cherry picked from commit ef00040)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants