Commit edc619fb authored by Maxime Orefice's avatar Maxime Orefice Committed by Adam Hegyi

Fix 500 for pipeline charts page

This MR creates a new index which will
improve the query performance and avoid
the query to timeout and return a 500.
parent d485da22
---
title: Fix 500 for pipeline charts page
merge_request: 38226
author:
type: fixed
# frozen_string_literal: true
class AddIndexToCiPipelineProjectIdCreatedAt < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
def up
add_concurrent_index :ci_pipelines, [:project_id, :created_at]
end
def down
remove_concurrent_index :ci_pipelines, [:project_id, :created_at]
end
end
2976f459ac9cd0780e90077ebe4ce5ca8dc41e62b4dab1f96e39738624ad9d04
\ No newline at end of file
......@@ -19148,6 +19148,8 @@ CREATE INDEX index_ci_pipelines_on_merge_request_id ON public.ci_pipelines USING
CREATE INDEX index_ci_pipelines_on_pipeline_schedule_id ON public.ci_pipelines USING btree (pipeline_schedule_id);
CREATE INDEX index_ci_pipelines_on_project_id_and_created_at ON public.ci_pipelines USING btree (project_id, created_at);
CREATE INDEX index_ci_pipelines_on_project_id_and_id_desc ON public.ci_pipelines USING btree (project_id, id DESC);
CREATE UNIQUE INDEX index_ci_pipelines_on_project_id_and_iid ON public.ci_pipelines USING btree (project_id, iid) WHERE (iid IS NOT NULL);
......
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