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
b7f24241
Commit
b7f24241
authored
Jun 19, 2020
by
Alper Akgun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Optimize rolling 28 days snippets counter
Adding an index to eliminate filters in for the postgres optimizer
parent
73b7082c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
0 deletions
+25
-0
changelogs/unreleased/221184-rolling-28-day-snippets-optimization.yml
...nreleased/221184-rolling-28-day-snippets-optimization.yml
+5
-0
db/migrate/20200618105638_add_index_on_id_and_created_at_to_snippets.rb
...00618105638_add_index_on_id_and_created_at_to_snippets.rb
+17
-0
db/structure.sql
db/structure.sql
+3
-0
No files found.
changelogs/unreleased/221184-rolling-28-day-snippets-optimization.yml
0 → 100644
View file @
b7f24241
---
title
:
Optimize rolling 28 days snippets counter
merge_request
:
34918
author
:
type
:
performance
db/migrate/20200618105638_add_index_on_id_and_created_at_to_snippets.rb
0 → 100644
View file @
b7f24241
# frozen_string_literal: true
class
AddIndexOnIdAndCreatedAtToSnippets
<
ActiveRecord
::
Migration
[
6.0
]
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
disable_ddl_transaction!
def
up
add_concurrent_index
:snippets
,
[
:id
,
:created_at
]
end
def
down
remove_concurrent_index
:snippets
,
[
:id
,
:created_at
]
end
end
db/structure.sql
View file @
b7f24241
...
@@ -10953,6 +10953,8 @@ CREATE INDEX index_snippets_on_description_trigram ON public.snippets USING gin
...
@@ -10953,6 +10953,8 @@ CREATE INDEX index_snippets_on_description_trigram ON public.snippets USING gin
CREATE
INDEX
index_snippets_on_file_name_trigram
ON
public
.
snippets
USING
gin
(
file_name
public
.
gin_trgm_ops
);
CREATE
INDEX
index_snippets_on_file_name_trigram
ON
public
.
snippets
USING
gin
(
file_name
public
.
gin_trgm_ops
);
CREATE
INDEX
index_snippets_on_id_and_created_at
ON
public
.
snippets
USING
btree
(
id
,
created_at
);
CREATE
INDEX
index_snippets_on_id_and_type
ON
public
.
snippets
USING
btree
(
id
,
type
);
CREATE
INDEX
index_snippets_on_id_and_type
ON
public
.
snippets
USING
btree
(
id
,
type
);
CREATE
INDEX
index_snippets_on_project_id_and_visibility_level
ON
public
.
snippets
USING
btree
(
project_id
,
visibility_level
);
CREATE
INDEX
index_snippets_on_project_id_and_visibility_level
ON
public
.
snippets
USING
btree
(
project_id
,
visibility_level
);
...
@@ -14075,6 +14077,7 @@ COPY "schema_migrations" (version) FROM STDIN;
...
@@ -14075,6 +14077,7 @@ COPY "schema_migrations" (version) FROM STDIN;
20200617001637
20200617001637
20200617001848
20200617001848
20200617002030
20200617002030
20200618105638
20200618134223
20200618134223
20200618134723
20200618134723
\
.
\
.
...
...
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