Commit 5db6847b authored by Andreas Brandl's avatar Andreas Brandl

Create partial indexes for pending/running builds

Changelog: performance
parent 6b180506
---
title: Create partial indexes for pending/running builds
merge_request: 60942
author:
type: performance
# frozen_string_literal: true
class CreatePartialIndexesForPendingAndRunningBuilds < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
disable_ddl_transaction!
INDEX_PENDING = 'index_ci_builds_runner_id_pending'
INDEX_RUNNING = 'index_ci_builds_runner_id_running'
def up
add_concurrent_index :ci_builds, :runner_id, where: "status = 'pending' AND type = 'Ci::Build'", name: INDEX_PENDING
add_concurrent_index :ci_builds, :runner_id, where: "status = 'running' AND type = 'Ci::Build'", name: INDEX_RUNNING
end
def down
remove_concurrent_index_by_name :ci_builds, INDEX_PENDING
remove_concurrent_index_by_name :ci_builds, INDEX_RUNNING
end
end
767cea885e6544b6958082397812357d7223b193d4b73bf09c8486dc2ec645d0
\ No newline at end of file
...@@ -22368,6 +22368,10 @@ CREATE INDEX index_ci_builds_on_user_id_and_created_at_and_type_eq_ci_build ON c ...@@ -22368,6 +22368,10 @@ CREATE INDEX index_ci_builds_on_user_id_and_created_at_and_type_eq_ci_build ON c
CREATE INDEX index_ci_builds_project_id_and_status_for_live_jobs_partial2 ON ci_builds USING btree (project_id, status) WHERE (((type)::text = 'Ci::Build'::text) AND ((status)::text = ANY (ARRAY[('running'::character varying)::text, ('pending'::character varying)::text, ('created'::character varying)::text]))); CREATE INDEX index_ci_builds_project_id_and_status_for_live_jobs_partial2 ON ci_builds USING btree (project_id, status) WHERE (((type)::text = 'Ci::Build'::text) AND ((status)::text = ANY (ARRAY[('running'::character varying)::text, ('pending'::character varying)::text, ('created'::character varying)::text])));
CREATE INDEX index_ci_builds_runner_id_pending ON ci_builds USING btree (runner_id) WHERE (((status)::text = 'pending'::text) AND ((type)::text = 'Ci::Build'::text));
CREATE INDEX index_ci_builds_runner_id_running ON ci_builds USING btree (runner_id) WHERE (((status)::text = 'running'::text) AND ((type)::text = 'Ci::Build'::text));
CREATE UNIQUE INDEX index_ci_builds_runner_session_on_build_id ON ci_builds_runner_session USING btree (build_id); CREATE UNIQUE INDEX index_ci_builds_runner_session_on_build_id ON ci_builds_runner_session USING btree (build_id);
CREATE INDEX index_ci_daily_build_group_report_results_on_group_id ON ci_daily_build_group_report_results USING btree (group_id); CREATE INDEX index_ci_daily_build_group_report_results_on_group_id ON ci_daily_build_group_report_results USING btree (group_id);
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment