Partial index for namespaces.type

Relates to https://gitlab.com/gitlab-org/gitlab-ce/issues/66956
上级 0844ec02
---
title: Partial index for namespaces.type
merge_request: 32876
author:
type: performance
# frozen_string_literal: true
class ExcludeNullsFromIndexOnNamespacesType < ActiveRecord::Migration[5.2]
include Gitlab::Database::MigrationHelpers
# Set this constant to true if this migration requires downtime.
DOWNTIME = false
disable_ddl_transaction!
def up
add_concurrent_index(:namespaces, :type, where: 'type is not null', name: 'index_namespaces_on_type_partial')
remove_concurrent_index_by_name(:namespaces, 'index_namespaces_on_type')
end
def down
add_concurrent_index(:namespaces, :type, name: 'index_namespaces_on_type')
remove_concurrent_index_by_name(:namespaces, 'index_namespaces_on_type_partial')
end
end
......@@ -2291,7 +2291,7 @@ ActiveRecord::Schema.define(version: 2019_09_12_061145) do
t.index ["runners_token_encrypted"], name: "index_namespaces_on_runners_token_encrypted", unique: true
t.index ["shared_runners_minutes_limit", "extra_shared_runners_minutes_limit"], name: "index_namespaces_on_shared_and_extra_runners_minutes_limit"
t.index ["trial_ends_on"], name: "index_namespaces_on_trial_ends_on", where: "(trial_ends_on IS NOT NULL)"
t.index ["type"], name: "index_namespaces_on_type"
t.index ["type"], name: "index_namespaces_on_type_partial", where: "(type IS NOT NULL)"
end
create_table "note_diff_files", id: :serial, force: :cascade do |t|
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册