Commit 1a469cbc authored by Alper Akgun's avatar Alper Akgun

Harden ci pipelines usage data with config sources

ci pipelines with auto_devops and config_repository config_source are
optimimized
parent cc29e1ba
---
title: Rework hardening CI pipelines usage data queries with an index
merge_request: 35494
author:
type: performance
# frozen_string_literal: true
class AddIndexOnUserIdAndCreatedAtWhereSourceToCiPipelines < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
def up
add_concurrent_index :ci_pipelines, [:user_id, :created_at, :config_source]
end
def down
remove_concurrent_index :ci_pipelines, [:user_id, :created_at, :config_source]
end
end
...@@ -18764,6 +18764,8 @@ CREATE INDEX index_ci_pipelines_on_project_idandrefandiddesc ON public.ci_pipeli ...@@ -18764,6 +18764,8 @@ CREATE INDEX index_ci_pipelines_on_project_idandrefandiddesc ON public.ci_pipeli
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);
CREATE INDEX index_ci_pipelines_on_user_id_and_created_at_and_config_source ON public.ci_pipelines USING btree (user_id, created_at, config_source);
CREATE INDEX index_ci_pipelines_on_user_id_and_created_at_and_source ON public.ci_pipelines USING btree (user_id, created_at, source); CREATE INDEX index_ci_pipelines_on_user_id_and_created_at_and_source ON public.ci_pipelines USING btree (user_id, created_at, source);
CREATE UNIQUE INDEX index_ci_refs_on_project_id_and_ref_path ON public.ci_refs USING btree (project_id, ref_path); CREATE UNIQUE INDEX index_ci_refs_on_project_id_and_ref_path ON public.ci_refs USING btree (project_id, ref_path);
...@@ -23573,6 +23575,7 @@ COPY "schema_migrations" (version) FROM STDIN; ...@@ -23573,6 +23575,7 @@ COPY "schema_migrations" (version) FROM STDIN;
20200630110826 20200630110826
20200702123805 20200702123805
20200703154822 20200703154822
20200704143633
20200706005325 20200706005325
\. \.
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