Add index on job.job_group_id A lot of queries are for jobs by their group ID. These queries are starting to show up in the slow query log. Add an index on the group ID to speed things up.
2 files changed, 28 insertions(+), 0 deletions(-) A buildsrht/alembic/versions/76bb268d91f7_add_index_on_job_job_group_id.py M schema.sql
A buildsrht/alembic/versions/76bb268d91f7_add_index_on_job_job_group_id.py => buildsrht/alembic/versions/76bb268d91f7_add_index_on_job_job_group_id.py +26 -0
@@ 0,0 1,26 @@ """add index on job.job_group_id Revision ID: 76bb268d91f7 Revises: 7e863c9389ef Create Date: 2022-12-02 14:58:35.947429 """ # revision identifiers, used by Alembic. revision = '76bb268d91f7' down_revision = '7e863c9389ef' from alembic import op import sqlalchemy as sa def upgrade(): op.execute(""" CREATE INDEX ix_job_job_group_id ON job USING btree (job_group_id); """) def downgrade(): op.execute(""" DROP INDEX ix_job_job_group_id; """)
M schema.sql => schema.sql +2 -0