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
bc68e1a2
Commit
bc68e1a2
authored
Mar 10, 2020
by
Alex Buijs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Optimizes clusters counter query
Adds an index for batch counting in usage data
parent
93f07c47
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
3 deletions
+27
-3
changelogs/unreleased/208923-enable-batch-counting-for-some-individual-queries.yml
...923-enable-batch-counting-for-some-individual-queries.yml
+5
-0
db/migrate/20200310123229_add_index_on_enabled_and_provider_type_and_id_to_clusters.rb
..._index_on_enabled_and_provider_type_and_id_to_clusters.rb
+19
-0
db/schema.rb
db/schema.rb
+1
-1
lib/gitlab/usage_data.rb
lib/gitlab/usage_data.rb
+2
-2
No files found.
changelogs/unreleased/208923-enable-batch-counting-for-some-individual-queries.yml
0 → 100644
View file @
bc68e1a2
---
title
:
Optimize clusters counters query performance in usage data
merge_request
:
26887
author
:
type
:
performance
db/migrate/20200310123229_add_index_on_enabled_and_provider_type_and_id_to_clusters.rb
0 → 100644
View file @
bc68e1a2
# frozen_string_literal: true
class
AddIndexOnEnabledAndProviderTypeAndIdToClusters
<
ActiveRecord
::
Migration
[
6.0
]
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
disable_ddl_transaction!
def
up
add_concurrent_index
:clusters
,
[
:enabled
,
:provider_type
,
:id
]
remove_concurrent_index
:clusters
,
:enabled
end
def
down
add_concurrent_index
:clusters
,
:enabled
remove_concurrent_index
:clusters
,
[
:enabled
,
:provider_type
,
:id
]
end
end
db/schema.rb
View file @
bc68e1a2
...
...
@@ -1125,7 +1125,7 @@ ActiveRecord::Schema.define(version: 2020_03_12_163407) do
t
.
integer
"management_project_id"
t
.
integer
"cleanup_status"
,
limit:
2
,
default:
1
,
null:
false
t
.
text
"cleanup_status_reason"
t
.
index
[
"enabled"
],
name:
"index_clusters_on_enable
d"
t
.
index
[
"enabled"
,
"provider_type"
,
"id"
],
name:
"index_clusters_on_enabled_and_provider_type_and_i
d"
t
.
index
[
"management_project_id"
],
name:
"index_clusters_on_management_project_id"
,
where:
"(management_project_id IS NOT NULL)"
t
.
index
[
"user_id"
],
name:
"index_clusters_on_user_id"
end
...
...
lib/gitlab/usage_data.rb
View file @
bc68e1a2
...
...
@@ -66,8 +66,8 @@ module Gitlab
clusters_disabled:
count
(
::
Clusters
::
Cluster
.
disabled
),
project_clusters_disabled:
count
(
::
Clusters
::
Cluster
.
disabled
.
project_type
),
group_clusters_disabled:
count
(
::
Clusters
::
Cluster
.
disabled
.
group_type
),
clusters_platforms_eks:
count
(
::
Clusters
::
Cluster
.
aws_installed
.
enabled
,
batch:
false
),
clusters_platforms_gke:
count
(
::
Clusters
::
Cluster
.
gcp_installed
.
enabled
,
batch:
false
),
clusters_platforms_eks:
count
(
::
Clusters
::
Cluster
.
aws_installed
.
enabled
),
clusters_platforms_gke:
count
(
::
Clusters
::
Cluster
.
gcp_installed
.
enabled
),
clusters_platforms_user:
count
(
::
Clusters
::
Cluster
.
user_provided
.
enabled
),
clusters_applications_helm:
count
(
::
Clusters
::
Applications
::
Helm
.
available
),
clusters_applications_ingress:
count
(
::
Clusters
::
Applications
::
Ingress
.
available
),
...
...
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