Commit ee8d2e77 authored by Doug Stull's avatar Doug Stull Committed by Adam Hegyi

Add index to project features for usage ping optimization

- need to add conditions to a new index to allow usage ping
  counter to work, where today it is hitting the failback
  condition.
parent f5c7d8eb
---
title: Optimize Project counters with respository enabled counter
merge_request: 26698
author:
type: performance
# frozen_string_literal: true
class AddIndexOnProjectIdAndRepositoryAccessLevelToProjectFeatures < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
INDEX_NAME = 'index_project_features_on_project_id_ral_20'
disable_ddl_transaction!
def up
add_concurrent_index :project_features, :project_id, where: 'repository_access_level = 20', name: INDEX_NAME
end
def down
remove_concurrent_index_by_name :project_features, INDEX_NAME
end
end
......@@ -3265,6 +3265,7 @@ ActiveRecord::Schema.define(version: 2020_03_09_195710) do
t.integer "forking_access_level"
t.index ["project_id"], name: "index_project_features_on_project_id", unique: true
t.index ["project_id"], name: "index_project_features_on_project_id_bal_20", where: "(builds_access_level = 20)"
t.index ["project_id"], name: "index_project_features_on_project_id_ral_20", where: "(repository_access_level = 20)"
end
create_table "project_group_links", id: :serial, force: :cascade do |t|
......
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