Commit 2715fda8 authored by Tiger Watson's avatar Tiger Watson Committed by Mayra Cabrera

Index ci_pipelines on pipeline_schedule_id and id

https://gitlab.com/gitlab-org/gitlab/-/merge_requests/50478
parent 0ee0578a
...@@ -17,7 +17,6 @@ class Projects::PipelineSchedulesController < Projects::ApplicationController ...@@ -17,7 +17,6 @@ class Projects::PipelineSchedulesController < Projects::ApplicationController
@scope = params[:scope] @scope = params[:scope]
@all_schedules = Ci::PipelineSchedulesFinder.new(@project).execute @all_schedules = Ci::PipelineSchedulesFinder.new(@project).execute
@schedules = Ci::PipelineSchedulesFinder.new(@project).execute(scope: params[:scope]) @schedules = Ci::PipelineSchedulesFinder.new(@project).execute(scope: params[:scope])
.includes(:last_pipeline)
end end
# rubocop: enable CodeReuse/ActiveRecord # rubocop: enable CodeReuse/ActiveRecord
......
---
title: Index ci_pipelines on pipeline_schedule_id and id
merge_request: 50478
author:
type: performance
# frozen_string_literal: true
class ReindexCiPipelinesOnScheduleIdAndId < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
OLD_INDEX_NAME = 'index_ci_pipelines_on_pipeline_schedule_id'
NEW_INDEX_NAME = 'index_ci_pipelines_on_pipeline_schedule_id_and_id'
disable_ddl_transaction!
def up
add_concurrent_index :ci_pipelines, [:pipeline_schedule_id, :id], name: NEW_INDEX_NAME
remove_concurrent_index_by_name :ci_pipelines, OLD_INDEX_NAME
end
def down
add_concurrent_index :ci_pipelines, :pipeline_schedule_id, name: OLD_INDEX_NAME
remove_concurrent_index_by_name :ci_pipelines, NEW_INDEX_NAME
end
end
e845a6704ac92881926cca56bf7fb01c6252f1fe2b2d94fc9d6548144126d6a5
\ No newline at end of file
...@@ -21088,7 +21088,7 @@ CREATE INDEX index_ci_pipelines_on_external_pull_request_id ON ci_pipelines USIN ...@@ -21088,7 +21088,7 @@ CREATE INDEX index_ci_pipelines_on_external_pull_request_id ON ci_pipelines USIN
CREATE INDEX index_ci_pipelines_on_merge_request_id ON ci_pipelines USING btree (merge_request_id) WHERE (merge_request_id IS NOT NULL); CREATE INDEX index_ci_pipelines_on_merge_request_id ON ci_pipelines USING btree (merge_request_id) WHERE (merge_request_id IS NOT NULL);
CREATE INDEX index_ci_pipelines_on_pipeline_schedule_id ON ci_pipelines USING btree (pipeline_schedule_id); CREATE INDEX index_ci_pipelines_on_pipeline_schedule_id_and_id ON ci_pipelines USING btree (pipeline_schedule_id, id);
CREATE INDEX index_ci_pipelines_on_project_id_and_id_desc ON ci_pipelines USING btree (project_id, id DESC); CREATE INDEX index_ci_pipelines_on_project_id_and_id_desc ON ci_pipelines USING btree (project_id, id DESC);
......
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