BigW Consortium Gitlab

Commit a8f2fcea by Stan Hu

Add an index for project_id in project_import_data to improve

performance We see that many slow queries on GitLab.com are dominated by finding the project import data for a specific project. Adding an index is the most straightforward way of fixing this. Closes #23748
parent c392b0cc
---
title: Add an index for project_id in project_import_data to improve performance
merge_request:
author:
class AddProjectImportDataProjectIndex < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers
# Set this constant to true if this migration requires downtime.
DOWNTIME = false
disable_ddl_transaction!
def change
add_concurrent_index :project_import_data, :project_id
end
end
......@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 20161103171205) do
ActiveRecord::Schema.define(version: 20161106185620) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
......@@ -867,6 +867,8 @@ ActiveRecord::Schema.define(version: 20161103171205) do
t.string "encrypted_credentials_salt"
end
add_index "project_import_data", ["project_id"], name: "index_project_import_data_on_project_id", using: :btree
create_table "projects", force: :cascade do |t|
t.string "name"
t.string "path"
......
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