Skip to content
This repository has been archived by the owner on Dec 15, 2018. It is now read-only.

Commit

Permalink
Add index to Task.status
Browse files Browse the repository at this point in the history
Summary:
We have monitoring and clean-up tasks that engage in table scans because they primarily care about
status; this is currently triggering our long-query warnings and creating noise.
Hopefully an index fixes that.
Size of the table is ~3m items in prod, so the indexing may take a bit, but we don't need
the index immediately, so adding it concurrently seems like a way to avoid downtime.

Test Plan: Staging, potentially a (new?) read replica

Reviewers: naphat

Reviewed By: naphat

Subscribers: changesbot, anupc

Differential Revision: https://tails.corp.dropbox.com/D233244
  • Loading branch information
kylec1 committed Oct 1, 2016
1 parent e9ef7e7 commit 8c49ac5
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions migrations/versions/2c49f64c0d4a_add_status_index_to_task.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
"""Add status index to task table.
Revision ID: 2c49f64c0d4a
Revises: 43397e521791
Create Date: 2016-09-29 15:45:51.104377
"""

# revision identifiers, used by Alembic.
revision = '2c49f64c0d4a'
down_revision = '43397e521791'

from alembic import op


def upgrade():
op.create_index('idx_task_status', 'task', ['status'], unique=False, postgresql_concurrently=True)


def downgrade():
op.drop_index('idx_task_status', table_name='task')

0 comments on commit 8c49ac5

Please sign in to comment.