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
55f87dd8
Commit
55f87dd8
authored
Nov 11, 2020
by
Andreas Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add missing expression indexes
Relates to
https://gitlab.com/gitlab-org/gitlab/-/issues/280826
parent
fd087488
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
61 additions
and
0 deletions
+61
-0
changelogs/unreleased/ab-add-missing-expression-indexes.yml
changelogs/unreleased/ab-add-missing-expression-indexes.yml
+5
-0
db/migrate/20201111152859_add_missing_expression_indexes.rb
db/migrate/20201111152859_add_missing_expression_indexes.rb
+43
-0
db/schema_migrations/20201111152859
db/schema_migrations/20201111152859
+1
-0
db/structure.sql
db/structure.sql
+12
-0
No files found.
changelogs/unreleased/ab-add-missing-expression-indexes.yml
0 → 100644
View file @
55f87dd8
---
title
:
Add missing expression indexes
merge_request
:
47424
author
:
type
:
performance
db/migrate/20201111152859_add_missing_expression_indexes.rb
0 → 100644
View file @
55f87dd8
# frozen_string_literal: true
class
AddMissingExpressionIndexes
<
ActiveRecord
::
Migration
[
6.0
]
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
disable_ddl_transaction!
INDEXES
=
[
[
:namespaces
,
:index_on_namespaces_lower_name
,
'LOWER(name)'
],
[
:namespaces
,
:index_on_namespaces_lower_path
,
'LOWER(path)'
],
[
:projects
,
:index_on_projects_lower_path
,
'LOWER(path)'
],
[
:routes
,
:index_on_routes_lower_path
,
'LOWER(path)'
],
[
:users
,
:index_on_users_lower_username
,
'LOWER(username)'
],
[
:users
,
:index_on_users_lower_email
,
'LOWER(email)'
]
]
def
up
# Those indexes had been introduced before, but they haven't been
# captured in structure.sql. For installations that already have it,
# this is a no-op - others will get it retroactively with
# this migration.
tables
=
Set
.
new
INDEXES
.
each
do
|
(
table
,
name
,
expression
)
|
unless
index_name_exists?
(
table
,
name
)
add_concurrent_index
table
,
expression
,
name:
name
tables
.
add
(
table
)
end
end
# Rebuild statistics on affected tables only
tables
.
each
do
|
table
|
execute
(
"ANALYZE
#{
table
}
"
)
end
end
def
down
# no-op
end
end
db/schema_migrations/20201111152859
0 → 100644
View file @
55f87dd8
4c5baa6a09a339fac544f830d5ef822b1e7e4eae8431bd91df5113125accbc77
\ No newline at end of file
db/structure.sql
View file @
55f87dd8
...
...
@@ -21326,12 +21326,24 @@ CREATE UNIQUE INDEX index_on_instance_statistics_recorded_at_and_identifier ON a
CREATE
INDEX
index_on_label_links_all_columns
ON
label_links
USING
btree
(
target_id
,
label_id
,
target_type
);
CREATE
INDEX
index_on_namespaces_lower_name
ON
namespaces
USING
btree
(
lower
((
name
)::
text
));
CREATE
INDEX
index_on_namespaces_lower_path
ON
namespaces
USING
btree
(
lower
((
path
)::
text
));
CREATE
INDEX
index_on_projects_lower_path
ON
projects
USING
btree
(
lower
((
path
)::
text
));
CREATE
INDEX
index_on_routes_lower_path
ON
routes
USING
btree
(
lower
((
path
)::
text
));
CREATE
UNIQUE
INDEX
index_on_segment_selections_group_id_segment_id
ON
analytics_devops_adoption_segment_selections
USING
btree
(
group_id
,
segment_id
);
CREATE
UNIQUE
INDEX
index_on_segment_selections_project_id_segment_id
ON
analytics_devops_adoption_segment_selections
USING
btree
(
project_id
,
segment_id
);
CREATE
INDEX
index_on_segment_selections_segment_id
ON
analytics_devops_adoption_segment_selections
USING
btree
(
segment_id
);
CREATE
INDEX
index_on_users_lower_email
ON
users
USING
btree
(
lower
((
email
)::
text
));
CREATE
INDEX
index_on_users_lower_username
ON
users
USING
btree
(
lower
((
username
)::
text
));
CREATE
INDEX
index_on_users_name_lower
ON
users
USING
btree
(
lower
((
name
)::
text
));
CREATE
INDEX
index_open_project_tracker_data_on_service_id
ON
open_project_tracker_data
USING
btree
(
service_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