Skip to content
Snippets Groups Projects
Commit b0eafaac authored by Brett Walker's avatar Brett Walker
Browse files

Add index for issues on relative position, project

and state
parent 8073b055
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -131,7 +131,7 @@ class Issue < ApplicationRecord
when 'due_date' then order_due_date_asc
when 'due_date_asc' then order_due_date_asc
when 'due_date_desc' then order_due_date_desc
when 'relative_position' then order_relative_position_asc
when 'relative_position' then order_relative_position_asc.with_order_id_desc
else
super
end
Loading
Loading
---
title: Add index for issues on relative position, project, and state for manual sorting
merge_request: 30542
author:
type: fixed
# frozen_string_literal: true
class AddIndexToIssuesRelativePosition < ActiveRecord::Migration[5.1]
include Gitlab::Database::MigrationHelpers
# Set this constant to true if this migration requires downtime.
DOWNTIME = false
disable_ddl_transaction!
INDEX_NAME = 'index_issues_on_project_id_and_state_and_rel_position_and_id'.freeze
def up
add_concurrent_index :issues, [:project_id, :state, :relative_position, :id], order: { id: :desc }, name: INDEX_NAME
end
def down
remove_concurrent_index_by_name :issues, INDEX_NAME
end
end
Loading
Loading
@@ -1682,6 +1682,7 @@ ActiveRecord::Schema.define(version: 2019_07_15_114644) do
t.index ["project_id", "created_at", "id", "state"], name: "index_issues_on_project_id_and_created_at_and_id_and_state", using: :btree
t.index ["project_id", "due_date", "id", "state"], name: "idx_issues_on_project_id_and_due_date_and_id_and_state_partial", where: "(due_date IS NOT NULL)", using: :btree
t.index ["project_id", "iid"], name: "index_issues_on_project_id_and_iid", unique: true, using: :btree
t.index ["project_id", "state", "relative_position", "id"], name: "index_issues_on_project_id_and_state_and_rel_position_and_id", order: { id: :desc }, using: :btree
t.index ["project_id", "updated_at", "id", "state"], name: "index_issues_on_project_id_and_updated_at_and_id_and_state", using: :btree
t.index ["relative_position"], name: "index_issues_on_relative_position", using: :btree
t.index ["state"], name: "index_issues_on_state", using: :btree
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment