Commit 8358d2bf authored by Adam Hegyi's avatar Adam Hegyi

Merge branch '208890-optimize-notes-counters' into 'master'

Optimize notes counters in usage data

See merge request gitlab-org/gitlab!26871
parents c146461e 0fc866aa
---
title: Optimize notes counters in usage data
merge_request: 26871
author:
type: performance
# frozen_string_literal: true
class AddIndexOnAuthorIdAndIdAndCreatedAtToNotes < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
def up
add_concurrent_index :notes, [:author_id, :created_at]
remove_concurrent_index :notes, [:author_id]
end
def down
add_concurrent_index :notes, [:author_id]
remove_concurrent_index :notes, [:author_id, :created_at]
end
end
...@@ -2829,7 +2829,7 @@ ActiveRecord::Schema.define(version: 2020_03_11_165635) do ...@@ -2829,7 +2829,7 @@ ActiveRecord::Schema.define(version: 2020_03_11_165635) do
t.boolean "resolved_by_push" t.boolean "resolved_by_push"
t.bigint "review_id" t.bigint "review_id"
t.boolean "confidential" t.boolean "confidential"
t.index ["author_id"], name: "index_notes_on_author_id" t.index ["author_id", "created_at"], name: "index_notes_on_author_id_and_created_at"
t.index ["commit_id"], name: "index_notes_on_commit_id" t.index ["commit_id"], name: "index_notes_on_commit_id"
t.index ["created_at"], name: "index_notes_on_created_at" t.index ["created_at"], name: "index_notes_on_created_at"
t.index ["discussion_id"], name: "index_notes_on_discussion_id" t.index ["discussion_id"], name: "index_notes_on_discussion_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