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
4cfccc11
Commit
4cfccc11
authored
May 26, 2020
by
Andreas Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adjust condition for partial index
https://gitlab.com/gitlab-org/gitlab/-/issues/219094
parent
db5d4783
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
2 deletions
+34
-2
changelogs/unreleased/ab-services-partial-indexes.yml
changelogs/unreleased/ab-services-partial-indexes.yml
+5
-0
db/migrate/20200526120714_change_partial_indexes_on_services.rb
...rate/20200526120714_change_partial_indexes_on_services.rb
+26
-0
db/structure.sql
db/structure.sql
+3
-2
No files found.
changelogs/unreleased/ab-services-partial-indexes.yml
0 → 100644
View file @
4cfccc11
---
title
:
Adjust condition for partial indexes on services table
merge_request
:
33044
author
:
type
:
performance
db/migrate/20200526120714_change_partial_indexes_on_services.rb
0 → 100644
View file @
4cfccc11
# frozen_string_literal: true
class
ChangePartialIndexesOnServices
<
ActiveRecord
::
Migration
[
6.0
]
include
Gitlab
::
Database
::
MigrationHelpers
# Set this constant to true if this migration requires downtime.
DOWNTIME
=
false
disable_ddl_transaction!
def
up
add_concurrent_index
:services
,
[
:type
,
:instance
],
unique:
true
,
where:
'instance = true'
,
name:
'index_services_on_type_and_instance_partial'
remove_concurrent_index_by_name
:services
,
'index_services_on_type_and_instance'
add_concurrent_index
:services
,
[
:type
,
:template
],
unique:
true
,
where:
'template = true'
,
name:
'index_services_on_type_and_template_partial'
remove_concurrent_index_by_name
:services
,
'index_services_on_type_and_template'
end
def
down
add_concurrent_index
:services
,
[
:type
,
:instance
],
unique:
true
,
where:
'instance IS TRUE'
,
name:
'index_services_on_type_and_instance'
remove_concurrent_index_by_name
:services
,
'index_services_on_type_and_instance_partial'
add_concurrent_index
:services
,
[
:type
,
:template
],
unique:
true
,
where:
'template IS TRUE'
,
name:
'index_services_on_type_and_template'
remove_concurrent_index_by_name
:services
,
'index_services_on_type_and_template_partial'
end
end
db/structure.sql
View file @
4cfccc11
...
...
@@ -10647,9 +10647,9 @@ CREATE INDEX index_services_on_type ON public.services USING btree (type);
CREATE
INDEX
index_services_on_type_and_id_and_template_when_active
ON
public
.
services
USING
btree
(
type
,
id
,
template
)
WHERE
(
active
=
true
);
CREATE
UNIQUE
INDEX
index_services_on_type_and_instance
ON
public
.
services
USING
btree
(
type
,
instance
)
WHERE
(
instance
IS
TRUE
);
CREATE
UNIQUE
INDEX
index_services_on_type_and_instance
_partial
ON
public
.
services
USING
btree
(
type
,
instance
)
WHERE
(
instance
=
true
);
CREATE
UNIQUE
INDEX
index_services_on_type_and_template
ON
public
.
services
USING
btree
(
type
,
template
)
WHERE
(
template
IS
TRUE
);
CREATE
UNIQUE
INDEX
index_services_on_type_and_template
_partial
ON
public
.
services
USING
btree
(
type
,
template
)
WHERE
(
template
=
true
);
CREATE
UNIQUE
INDEX
index_shards_on_name
ON
public
.
shards
USING
btree
(
name
);
...
...
@@ -13934,5 +13934,6 @@ COPY "schema_migrations" (version) FROM STDIN;
20200519171058
20200525114553
20200525121014
20200526120714
\
.
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