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
f191e9f4
Commit
f191e9f4
authored
Mar 06, 2020
by
Alper Akgun
Committed by
Mayra Cabrera
Mar 06, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Optimizes the todo counter query
adds an index for batch counting in usage data
parent
0494c5ba
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
1 deletion
+23
-1
changelogs/unreleased/208891-optimize-todos-counters.yml
changelogs/unreleased/208891-optimize-todos-counters.yml
+5
-0
db/migrate/20200306170531_add_index_on_author_id_and_created_at_to_todos.rb
...6170531_add_index_on_author_id_and_created_at_to_todos.rb
+16
-0
db/schema.rb
db/schema.rb
+2
-1
No files found.
changelogs/unreleased/208891-optimize-todos-counters.yml
0 → 100644
View file @
f191e9f4
---
title
:
Optimize todos counters in usage data
merge_request
:
26442
author
:
type
:
performance
db/migrate/20200306170531_add_index_on_author_id_and_created_at_to_todos.rb
0 → 100644
View file @
f191e9f4
# frozen_string_literal: true
class
AddIndexOnAuthorIdAndCreatedAtToTodos
<
ActiveRecord
::
Migration
[
6.0
]
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
disable_ddl_transaction!
def
up
add_concurrent_index
:todos
,
[
:author_id
,
:created_at
]
end
def
down
remove_concurrent_index
:todos
,
[
:author_id
,
:created_at
]
end
end
db/schema.rb
View file @
f191e9f4
...
...
@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
version:
2020_03_0
4_160823
)
do
ActiveRecord
::
Schema
.
define
(
version:
2020_03_0
6_170531
)
do
# These are extensions that must be enabled in order to support this database
enable_extension
"pg_trgm"
...
...
@@ -4150,6 +4150,7 @@ ActiveRecord::Schema.define(version: 2020_03_04_160823) do
t
.
integer
"note_id"
t
.
string
"commit_id"
t
.
integer
"group_id"
t
.
index
[
"author_id"
,
"created_at"
],
name:
"index_todos_on_author_id_and_created_at"
t
.
index
[
"author_id"
],
name:
"index_todos_on_author_id"
t
.
index
[
"commit_id"
],
name:
"index_todos_on_commit_id"
t
.
index
[
"group_id"
],
name:
"index_todos_on_group_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