Sha256: a2df87dc065938cfaa76f250f8cc18dd4a33ba80a6e2ea2a639ca175be4415f9

Contents?: true

Size: 457 Bytes

Versions: 4

Compression:

Stored size: 457 Bytes

Contents

# frozen_string_literal: true

module RailsPGExtras
  def self.index_usage_description
    "Index hit rate (effective databases are at 99% and up)"
  end

  def self.index_usage_sql
    <<-EOS
SELECT relname,
   CASE idx_scan
     WHEN 0 THEN 'Insufficient data'
     ELSE (100 * idx_scan / (seq_scan + idx_scan))::text
   END percent_of_times_index_used,
   n_live_tup rows_in_table
 FROM
   pg_stat_user_tables
 ORDER BY
   n_live_tup DESC;
EOS
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rails-pg-extras-0.4.1 lib/rails-pg-extras/queries/index_usage.rb
rails-pg-extras-0.4.0 lib/rails-pg-extras/queries/index_usage.rb
rails-pg-extras-0.3.0 lib/rails-pg-extras/queries/index_usage.rb
rails-pg-extras-0.2.0 lib/rails-pg-extras/queries/index_usage.rb