Skip to content

Remove unused index idx_last_scheduling_decision on dag_run table - #39275

Merged
jedcunningham merged 5 commits into
apache:mainfrom
astronomer:remove-idx-last-scheduling-decision
Apr 30, 2024
Merged

jedcunningham merged 5 commits into
apache:mainfrom
astronomer:remove-idx-last-scheduling-decision

Conversation

@pankajkoti

Copy link
Copy Markdown
Member

We added idx_last_scheduling_decision on the
last_scheduling_decision column in the dag_run table
with Airflow 2.0.0. However, this index seems to have been
unused with 0 index_scan counts throughout. I verified
scheduler performance metrics are not affected after removing
this index.

Additionally, this index seems to occupy huge storage space,
almost half the size of the table (e.g. on one deployment that
I checked, the table occupies 9.8GB of records, but this single
index alone occupies 5.7 GB)


^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in newsfragments.

@pankajkoti
pankajkoti force-pushed the remove-idx-last-scheduling-decision branch 2 times, most recently from 6ae0e52 to d86e3f5 Compare April 26, 2024 11:59

@Taragolis Taragolis left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

single index alone occupies 5.7 GB

That a bit strange that this index could use such amount of storage. Maybe this happen due to disabled auto vacuum daemon or never.

In general I agree that this index unlikely will ever use in Postgres. There is couple places where last_scheduling_decision use in sorting or filtration, but every time it use alongside with other fields so this much less effective rather than even make seq scan or use other indexes for optimise particular queries.

So removal of this one could make more benefits rather than keep it

@pankajkoti
pankajkoti requested a review from utkarsharma2 April 26, 2024 13:02
@pankajkoti pankajkoti added this to the Airflow 2.9.1 milestone Apr 26, 2024
Comment thread docs/apache-airflow/migrations-ref.rst Resolved
Comment thread docs/apache-airflow/migrations-ref.rst Resolved
@pankajkoti
pankajkoti force-pushed the remove-idx-last-scheduling-decision branch from bcb8a9d to 8cd2f08 Compare April 29, 2024 12:49
@pankajkoti
pankajkoti requested a review from vincbeck April 29, 2024 13:57
Comment thread airflow/utils/db.py Resolved
@pankajkoti

pankajkoti commented Apr 30, 2024 •

Copy link
Copy Markdown
Member Author

@vincbeck @Taragolis @jedcunningham @utkarsharma2 addressed the review comments so far. Requesting re-review please.

@pankajkoti
pankajkoti requested a review from Taragolis April 30, 2024 13:08
@pankajkoti
pankajkoti force-pushed the remove-idx-last-scheduling-decision branch from 4928d9d to e3bca9e Compare April 30, 2024 13:15

@vincbeck vincbeck left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Much better! Thanks!

@jedcunningham
jedcunningham merged commit 92ffab6 into apache:main Apr 30, 2024
@jedcunningham
jedcunningham deleted the remove-idx-last-scheduling-decision branch April 30, 2024 19:57
@jedcunningham jedcunningham added the type:bug-fix Changelog: Bug Fixes label Apr 30, 2024
@pankajkoti

pankajkoti commented May 1, 2024 •

Copy link
Copy Markdown
Member Author

Bringing up a hidden in a resolved conversation comment from Jed in a conversation so that it appears here upfront

From Jed
"cc @ephraimbuddy we will want to remove 2.10.0 when we cherry-pick this back to v2-9."

The comment talks about removing this line https://github.com/apache/airflow/pull/39275/files#diff-730eff695b18ad05249293cc3361da7424aba164857e9c5d26e50bd3a78ba6e7R95 when cherry-picking back to v2-9

@ephraimbuddy

Copy link
Copy Markdown
Contributor

Bringing up a hidden in a resolved conversation comment from Jed in a conversation so that it appears here upfront

From Jed "cc @ephraimbuddy we will want to remove 2.10.0 when we cherry-pick this back to v2-9."

The comment talks about removing this line https://github.com/apache/airflow/pull/39275/files#diff-730eff695b18ad05249293cc3361da7424aba164857e9c5d26e50bd3a78ba6e7R95 when cherry-picking back to v2-9

Pre-commit will still fix it when we cherry pick. Nothing to worry about

@ephraimbuddy ephraimbuddy added type:misc/internal Changelog: Misc changes that should appear in change log and removed type:bug-fix Changelog: Bug Fixes labels Jun 4, 2024
ephraimbuddy pushed a commit that referenced this pull request Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:db-migrations PRs with DB migration kind:documentation type:misc/internal Changelog: Misc changes that should appear in change log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants