Commit 8d942cb1 authored by huzaifaiftikhar1's avatar huzaifaiftikhar1 Committed by Huzaifa Iftikhar

Replace marked_for_deletion_at column with id to get index only scan

parent b90bc5ad
......@@ -6,10 +6,10 @@ class AddIndexToProjectsOnMarkedForDeletionAt < Gitlab::Database::Migration[1.0]
INDEX_NAME = 'index_projects_not_aimed_for_deletion'
def up
add_concurrent_index :projects, :marked_for_deletion_at, where: 'marked_for_deletion_at IS NULL', name: INDEX_NAME
add_concurrent_index :projects, :id, where: 'marked_for_deletion_at IS NULL', name: INDEX_NAME
end
def down
remove_concurrent_index :projects, :marked_for_deletion_at, name: INDEX_NAME
remove_concurrent_index :projects, :id, name: INDEX_NAME
end
end
......@@ -27108,7 +27108,7 @@ CREATE INDEX index_projects_api_vis20_path ON projects USING btree (path, id) WH
CREATE INDEX index_projects_api_vis20_updated_at ON projects USING btree (updated_at, id) WHERE (visibility_level = 20);
CREATE INDEX index_projects_not_aimed_for_deletion ON projects USING btree (marked_for_deletion_at) WHERE (marked_for_deletion_at IS NULL);
CREATE INDEX index_projects_not_aimed_for_deletion ON projects USING btree (id) WHERE (marked_for_deletion_at IS NULL);
CREATE INDEX index_projects_on_created_at_and_id ON projects USING btree (created_at, id);
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