Commit f89905ce authored by Mayra Cabrera's avatar Mayra Cabrera

Merge branch 'al-215200-snippets-by-type-usage-counter' into 'master'

Add individual usage counters for snippet types

See merge request gitlab-org/gitlab!32885
parents e8550c5d 2fdc2449
---
title: Add index on id and type for Snippets
merge_request: 32885
author:
type: performance
# frozen_string_literal: true
class AddIndexOnSnippetTypeAndId < ActiveRecord::Migration[6.0]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
disable_ddl_transaction!
def up
add_concurrent_index :snippets, [:id, :type]
end
def down
remove_concurrent_index :snippets, [:id, :type]
end
end
...@@ -10745,6 +10745,8 @@ CREATE INDEX index_snippets_on_description_trigram ON public.snippets USING gin ...@@ -10745,6 +10745,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_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);
CREATE INDEX index_snippets_on_title_trigram ON public.snippets USING gin (title public.gin_trgm_ops); CREATE INDEX index_snippets_on_title_trigram ON public.snippets USING gin (title public.gin_trgm_ops);
...@@ -14025,6 +14027,7 @@ COPY "schema_migrations" (version) FROM STDIN; ...@@ -14025,6 +14027,7 @@ COPY "schema_migrations" (version) FROM STDIN;
20200521225327 20200521225327
20200521225337 20200521225337
20200521225346 20200521225346
20200522235146
20200525114553 20200525114553
20200525121014 20200525121014
20200526000407 20200526000407
......
...@@ -133,6 +133,8 @@ module Gitlab ...@@ -133,6 +133,8 @@ module Gitlab
releases: count(Release), releases: count(Release),
remote_mirrors: count(RemoteMirror), remote_mirrors: count(RemoteMirror),
snippets: count(Snippet), snippets: count(Snippet),
personal_snippets: count(PersonalSnippet),
project_snippets: count(ProjectSnippet),
suggestions: count(Suggestion), suggestions: count(Suggestion),
terraform_reports: count(::Ci::JobArtifact.terraform_reports), terraform_reports: count(::Ci::JobArtifact.terraform_reports),
terraform_states: count(::Terraform::State), terraform_states: count(::Terraform::State),
......
...@@ -124,6 +124,8 @@ module UsageDataHelpers ...@@ -124,6 +124,8 @@ module UsageDataHelpers
releases releases
remote_mirrors remote_mirrors
snippets snippets
personal_snippets
project_snippets
suggestions suggestions
terraform_reports terraform_reports
terraform_states terraform_states
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment