Skip to content

High CPU utilisation caused by frequent updates to dag_run table #42053

Closed

Description

@kenho811-b1

Apache Airflow version

Other Airflow 2 version (please specify below)

If "Other Airflow 2 version" selected, which one?

2.9.1

What happened?

Setup
We are self-hosting Airflow via Helm Chart. We use google's CloudSQL as our Airflow metadata store.

Issue

We observe that the below query has been called many times, causes database locks and is causing high CPU utilisation

UPDATE
  dag_run
SET
  last_scheduling_decision=$1::timestamptz,
  updated_at=$2::timestamptz
WHERE
  dag_run.id = $3

For instance, referring to the below screenshot, in 1 day, 193,362 times has been called.

image

Spec of the CLoudSQL instance

The CLoudSQL instance has 4 vCPUs and 15GB ram.

What you think should happen instead?

Updates to the dag_run on last_scheduling_decision should be reduced (or configurable?)

So we can test if database CPU utilisation can be reduced and Database locking problem can be resolved.

How to reproduce

Not easily reproducible.

==========

At the time of the UPDATE SQLs, I observe that only 5 instances of DAG runs are running.

We have a similar setup in another environment where the other CloudSQL instance also has only 4 vCPUs.

In the other environment, however, the number of times the UPDATE SQL is called is smaller. Also no huge database locks are observed in the other environment.

Operating System

linux

Versions of Apache Airflow Providers

No response

Deployment

Official Apache Airflow Helm Chart

Deployment details

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. boring-cyborg commented on Sep 6, 2024

    @boring-cyborg

    Thanks for opening your first issue here! Be sure to follow the issue template! If you are willing to raise PR to address this issue please do so, no need to wait for approval.

  2. jkramer-ginkgo commented on Dec 20, 2024

    @jkramer-ginkgo
    Contributor

    I'm experiencing this issue too in 2.10.4. Looks like the index was removed because unused, but I'm clearly seeing queries that would be using this index

  3. potiuk commented on Dec 20, 2024

    @potiuk
    Member

    I'm experiencing this issue too in 2.10.4. Looks like the index was removed because unused, but I'm clearly seeing queries that would be using this index

    coudl you please epxlain what your queries are you see and logs where you observe it?

  4. jkramer-ginkgo commented on Dec 20, 2024

    @jkramer-ginkgo
    Contributor

    I can share screenshots from our RDS performance insights dashboard (the red corresponds to locking, which is why I was looking in to the index in the first place)

    image image image
  5. jkramer-ginkgo commented on Dec 20, 2024

    @jkramer-ginkgo
    Contributor

    Apologies, definitely a brain fart. This query wouldn't use the index mentioned!

  6. jkramer-ginkgo commented on Dec 20, 2024

    @jkramer-ginkgo
    Contributor

    This issue itself is still relevant (and what I'm observing). But the index removal is irrelevant.

  7. added
    Can't ReproduceThe problem cannot be reproduced
    and removed
    needs-triagelabel for new issues that we didn't triage yet
    on Dec 13, 2025
  8. locked and limited conversation to collaborators on Jan 24, 2026
  9. converted this issue into a discussion #61003 on Jan 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions