Skip to content

perf: change default sort from run_after to id in DAG runs list UI#62974

Closed
kckoh wants to merge 1 commit intoapache:mainfrom
kckoh:fix/dagrun-index-ui
Closed

perf: change default sort from run_after to id in DAG runs list UI#62974
kckoh wants to merge 1 commit intoapache:mainfrom
kckoh:fix/dagrun-index-ui

Conversation

@kckoh
Copy link
Copy Markdown

@kckoh kckoh commented Mar 6, 2026

Summary

Changes the default sort column in the DAG runs list UI from run_after to id to eliminate an unnecessary temporary B-tree sort, improving query performance on the GET /dags/{dag_id}/dagRuns endpoint.

Problem

When sorting by run_after, SQLite/PostgreSQL cannot satisfy the ORDER BY using an existing index, resulting in an additional in-memory sort step (USE TEMP B-TREE FOR ORDER BY).

Solution

Sorting by id (primary key) allows the query planner to use the existing index directly, eliminating the temp sort entirely.

related: #62025


Was generative AI tooling used to co-author this PR?

No.

  • 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 or {issue_number}.significant.rst, in airflow-core/newsfragments.

@boring-cyborg
Copy link
Copy Markdown

boring-cyborg Bot commented Mar 6, 2026

Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide (https://github.com/apache/airflow/blob/main/contributing-docs/README.rst)
Here are some useful points:

  • Pay attention to the quality of your code (ruff, mypy and type annotations). Our prek-hooks will help you with that.
  • In case of a new feature add useful documentation (in docstrings or in docs/ directory). Adding a new operator? Check this short guide Consider adding an example DAG that shows how users should use it.
  • Consider using Breeze environment for testing locally, it's a heavy docker but it ships with a working Airflow and a lot of integrations.
  • Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
  • Please follow ASF Code of Conduct for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
  • Be sure to read the Airflow Coding style.
  • Always keep your Pull Requests rebased, otherwise your build might fail due to changes not related to your commits.
    Apache Airflow is a community-driven project and together we are making it better 🚀.
    In case of doubts contact the developers at:
    Mailing List: dev@airflow.apache.org
    Slack: https://s.apache.org/airflow-slack

@boring-cyborg boring-cyborg Bot added the area:UI Related to UI/UX. For Frontend Developers. label Mar 6, 2026
@kckoh kckoh force-pushed the fix/dagrun-index-ui branch 2 times, most recently from 65ece23 to 8dbc988 Compare March 6, 2026 05:18
Copy link
Copy Markdown
Member

@pierrejeambrun pierrejeambrun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you provide a benchmark to highlight the improvements you're witnessing?

On my end it doesn't seem to change anything, it seems like something else in the query is preventing the index from behind used, or the bottleneck isn't caused by the missing index.

Before

Image

After

Image

@kckoh
Copy link
Copy Markdown
Author

kckoh commented Mar 9, 2026

you provide a benchmark to highlight the improvements you're witnessing?

on my side, the index did go through but the improvements might have been trivial. closing the PR as the improvements are not visible.

@kckoh kckoh closed this Mar 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:UI Related to UI/UX. For Frontend Developers.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants