Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove usused index on task instance #36737

Merged
merged 4 commits into from
Jan 13, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,12 @@

def upgrade():
"""Apply Add index to task_instance table"""
op.create_index(
"ti_state_incl_start_date",
"task_instance",
["dag_id", "task_id", "state"],
postgresql_include=["start_date"],
)
# We don't add this index anymore because it's not useful.
pass


def downgrade():
"""Unapply Add index to task_instance table"""
op.drop_index("ti_state_incl_start_date", table_name="task_instance")
# At 2.9 we removed this index as it is not used, and changed this migration not to add it
# So we use drop if exists (cus it might not be there)
dstandish marked this conversation as resolved.
Show resolved Hide resolved
op.drop_index("ti_state_incl_start_date", table_name="task_instance", if_exists=True)
1 change: 0 additions & 1 deletion airflow/models/taskinstance.py
Original file line number Diff line number Diff line change
Expand Up @@ -1259,7 +1259,6 @@ class TaskInstance(Base, LoggingMixin):
# Existing "ti_state_lkp" is not enough for such query when this table has millions of rows, since
# rows have to be fetched in order to retrieve the start_date column. With this index, INDEX ONLY SCAN
# is performed and that query runs within milliseconds.
Index("ti_state_incl_start_date", dag_id, task_id, state, postgresql_include=["start_date"]),
Index("ti_pool", pool, state, priority_weight),
Index("ti_job_id", job_id),
Index("ti_trigger_id", trigger_id),
Expand Down
2 changes: 1 addition & 1 deletion docs/apache-airflow/img/airflow_erd.sha256
Original file line number Diff line number Diff line change
@@ -1 +1 @@
194706fc390025f473f73ce934bfe4b394b50ce76748e5df33ae643e38538357
ba96d49079fd4b81687cad9fbeb1d3f82a214b9277de46eaed3b60126210f7d8
4 changes: 2 additions & 2 deletions docs/apache-airflow/img/airflow_erd.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion docs/apache-airflow/migrations-ref.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ Here's the list of all the Database Migrations that are executed via when you ru
+---------------------------------+-------------------+-------------------+--------------------------------------------------------------+
| Revision ID | Revises ID | Airflow Version | Description |
+=================================+===================+===================+==============================================================+
| ``10b52ebd31f7`` (head) | ``bd5dfbe21f88`` | ``2.8.0`` | Add processor_subdir to ImportError. |
| ``88344c1d9134`` (head) | ``10b52ebd31f7`` | ``2.9.0`` | refactor dag run indexes |
+---------------------------------+-------------------+-------------------+--------------------------------------------------------------+
| ``10b52ebd31f7`` | ``bd5dfbe21f88`` | ``2.8.0`` | Add processor_subdir to ImportError. |
+---------------------------------+-------------------+-------------------+--------------------------------------------------------------+
| ``bd5dfbe21f88`` | ``f7bf2a57d0a6`` | ``2.8.0`` | Make connection login/password TEXT |
+---------------------------------+-------------------+-------------------+--------------------------------------------------------------+
Expand Down
Loading