Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
0fc866aa
Commit
0fc866aa
authored
Mar 12, 2020
by
Alper Akgun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Optimizes the notes counter query
Adds an index for batch counting in usage data
parent
c943774f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
1 deletion
+25
-1
changelogs/unreleased/208890-optimize-notes-counters.yml
changelogs/unreleased/208890-optimize-notes-counters.yml
+5
-0
db/migrate/20200310133822_add_index_on_author_id_and_id_and_created_at_to_notes.rb
..._add_index_on_author_id_and_id_and_created_at_to_notes.rb
+19
-0
db/schema.rb
db/schema.rb
+1
-1
No files found.
changelogs/unreleased/208890-optimize-notes-counters.yml
0 → 100644
View file @
0fc866aa
---
title
:
Optimize notes counters in usage data
merge_request
:
26871
author
:
type
:
performance
db/migrate/20200310133822_add_index_on_author_id_and_id_and_created_at_to_notes.rb
0 → 100644
View file @
0fc866aa
# 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
db/schema.rb
View file @
0fc866aa
...
...
@@ -2826,7 +2826,7 @@ ActiveRecord::Schema.define(version: 2020_03_11_165635) do
t
.
boolean
"resolved_by_push"
t
.
bigint
"review_id"
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
[
"created_at"
],
name:
"index_notes_on_created_at"
t
.
index
[
"discussion_id"
],
name:
"index_notes_on_discussion_id"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment