Commit 585b39fe authored by Mayra Cabrera's avatar Mayra Cabrera

Merge branch '217748-pipeline-index-endpoint-performance' into 'master'

Add project_id, user_id, status, ref index to ci_pipelines

See merge request gitlab-org/gitlab!33290
parents c78ada3f acec65a5
---
title: Add project_id, user_id, status, ref index to ci_pipelines
merge_request: 33290
author:
type: performance
# frozen_string_literal: true
class AddProjectIdUserIdStatusRefIndexToCiPipelines < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
SOURCE_PARENT_PIPELINE = 12
def up
add_concurrent_index(
:ci_pipelines,
[:project_id, :user_id, :status, :ref],
where: "source != #{SOURCE_PARENT_PIPELINE}"
)
end
def down
remove_concurrent_index(
:ci_pipelines,
[:project_id, :user_id, :status, :ref],
where: "source != #{SOURCE_PARENT_PIPELINE}"
)
end
end
...@@ -9416,6 +9416,8 @@ CREATE INDEX index_ci_pipelines_on_project_id_and_status_and_config_source ON pu ...@@ -9416,6 +9416,8 @@ CREATE INDEX index_ci_pipelines_on_project_id_and_status_and_config_source ON pu
CREATE INDEX index_ci_pipelines_on_project_id_and_status_and_updated_at ON public.ci_pipelines USING btree (project_id, status, updated_at); CREATE INDEX index_ci_pipelines_on_project_id_and_status_and_updated_at ON public.ci_pipelines USING btree (project_id, status, updated_at);
CREATE INDEX index_ci_pipelines_on_project_id_and_user_id_and_status_and_ref ON public.ci_pipelines USING btree (project_id, user_id, status, ref) WHERE (source <> 12);
CREATE INDEX index_ci_pipelines_on_project_idandrefandiddesc ON public.ci_pipelines USING btree (project_id, ref, id DESC); CREATE INDEX index_ci_pipelines_on_project_idandrefandiddesc ON public.ci_pipelines USING btree (project_id, ref, id DESC);
CREATE INDEX index_ci_pipelines_on_status ON public.ci_pipelines USING btree (status); CREATE INDEX index_ci_pipelines_on_status ON public.ci_pipelines USING btree (status);
...@@ -13791,6 +13793,7 @@ COPY "schema_migrations" (version) FROM STDIN; ...@@ -13791,6 +13793,7 @@ COPY "schema_migrations" (version) FROM STDIN;
20200527152657 20200527152657
20200528054112 20200528054112
20200528123703 20200528123703
20200528125905
20200603073101 20200603073101
\. \.
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