Skip to content

Avoid N+1 team-name queries in bulk Dag run authorization#68286

Open
yuseok89 wants to merge 2 commits into
apache:mainfrom
yuseok89:batch-dag-run-team-lookup
Open

Avoid N+1 team-name queries in bulk Dag run authorization#68286
yuseok89 wants to merge 2 commits into
apache:mainfrom
yuseok89:batch-dag-run-team-lookup

Conversation

@yuseok89

@yuseok89 yuseok89 commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

_build_dag_run_access_requests() (bulk Dag run authorization) resolved each Dag's team with a per-Dag DagModel.get_team_name() call. It now uses the existing batched DagModel.get_dag_id_to_team_name_mapping() — one query for all Dags.

Team-name queries when authorizing N distinct Dags (cold cache):

Before After
N Dags N 1
no Dags 0 0 (skipped)

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

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

@boring-cyborg boring-cyborg Bot added the area:API Airflow's REST/HTTP API label Jun 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:API Airflow's REST/HTTP API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant