Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/database/postgres_index_bloat_estimate.rb')
-rw-r--r--lib/gitlab/database/postgres_index_bloat_estimate.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/gitlab/database/postgres_index_bloat_estimate.rb b/lib/gitlab/database/postgres_index_bloat_estimate.rb
new file mode 100644
index 00000000000..379227bf87c
--- /dev/null
+++ b/lib/gitlab/database/postgres_index_bloat_estimate.rb
@@ -0,0 +1,18 @@
+# frozen_string_literal: true
+
+module Gitlab
+ module Database
+ # Use this model with care: Retrieving bloat statistics
+ # for all indexes can be expensive in a large database.
+ #
+ # Best used on a per-index basis.
+ class PostgresIndexBloatEstimate < ActiveRecord::Base
+ self.table_name = 'postgres_index_bloat_estimates'
+ self.primary_key = 'identifier'
+
+ belongs_to :index, foreign_key: :identifier, class_name: 'Gitlab::Database::PostgresIndex'
+
+ alias_attribute :bloat_size, :bloat_size_bytes
+ end
+ end
+end