Commit 02cdc40d authored by Andreas Brandl's avatar Andreas Brandl

Expand index on ci_pipelines

For background see
https://gitlab.com/gitlab-org/gitlab/-/issues/292454#note_463034491
parent c6cdc324
---
title: Expand index on ci_pipelines
merge_request: 49604
author:
type: performance
# frozen_string_literal: true
class ExpandCiPipelinesIndexOnCiRefId < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
NEW_NAME = 'index_ci_pipelines_on_ci_ref_id_and_more'
OLD_NAME = 'index_ci_pipelines_on_ci_ref_id'
def up
add_concurrent_index :ci_pipelines, %i[ci_ref_id id source status], order: { id: :desc }, where: 'ci_ref_id IS NOT NULL', name: NEW_NAME
remove_concurrent_index_by_name :ci_pipelines, OLD_NAME
end
def down
add_concurrent_index :ci_pipelines, :ci_ref_id, where: 'ci_ref_id IS NOT NULL', name: OLD_NAME
remove_concurrent_index_by_name :ci_pipelines, NEW_NAME
end
end
98e132fd1daadca14b4313783691c523290efdc81372ec8416bcea1a597376bf
\ No newline at end of file
......@@ -20866,7 +20866,7 @@ CREATE INDEX index_ci_pipelines_for_ondemand_dast_scans ON ci_pipelines USING bt
CREATE INDEX index_ci_pipelines_on_auto_canceled_by_id ON ci_pipelines USING btree (auto_canceled_by_id);
CREATE INDEX index_ci_pipelines_on_ci_ref_id ON ci_pipelines USING btree (ci_ref_id) WHERE (ci_ref_id IS NOT NULL);
CREATE INDEX index_ci_pipelines_on_ci_ref_id_and_more ON ci_pipelines USING btree (ci_ref_id, id DESC, source, status) WHERE (ci_ref_id IS NOT NULL);
CREATE INDEX index_ci_pipelines_on_external_pull_request_id ON ci_pipelines USING btree (external_pull_request_id) WHERE (external_pull_request_id 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