Skip to content

ti.get_previous_ti method is not optimized #72358

Closed

Description

@PolitePp

Under which category would you file this issue?

Airflow Core

Apache Airflow version

3.3.0

What happened and how to reproduce it?

When we execute ti.get_previous_ti(state='success') airflow collects all task instances from the database and then gets the latest on api side. It's not effective, because the query itself already has sorting by the date

What you think should happen instead?

We can add limit 1 to the query and prevent api load

Operating System

No response

Deployment

None

Apache Airflow Provider(s)

No response

Versions of Apache Airflow Providers

No response

Official Helm Chart version

Not Applicable

Kubernetes Version

No response

Helm Chart configuration

No response

Docker Image customizations

No response

Anything else?

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Activity

  1. added
    kind:bug
    needs-triage
    on Sep 1, 2026
  2. removed
    needs-triage
    on Nov 6, 2026
  3. shahar1 commented on Nov 6, 2026

    @shahar1
    Contributor

    Solved by #72699

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind:bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions