Class: RubyPgExtras::DiagnoseData
- Inherits:
-
Object
- Object
- RubyPgExtras::DiagnoseData
- Defined in:
- lib/ruby_pg_extras/diagnose_data.rb
Constant Summary collapse
- PG_EXTRAS_TABLE_CACHE_HIT_MIN_EXPECTED =
"0.985"- PG_EXTRAS_INDEX_CACHE_HIT_MIN_EXPECTED =
"0.985"- PG_EXTRAS_UNUSED_INDEXES_MAX_SCANS =
20- PG_EXTRAS_UNUSED_INDEXES_MIN_SIZE_BYTES =
1000000 bytes
Filesize.from("1 MB").to_i
- PG_EXTRAS_NULL_INDEXES_MIN_SIZE_MB =
1 MB
1- PG_EXTRAS_NULL_MIN_NULL_FRAC_PERCENT =
50%
50- PG_EXTRAS_BLOAT_MIN_VALUE =
10- PG_EXTRAS_OUTLIERS_MIN_EXEC_RATIO =
33%
33
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.call ⇒ Object
16 17 18 |
# File 'lib/ruby_pg_extras/diagnose_data.rb', line 16 def self.call new.call end |
Instance Method Details
#call ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/ruby_pg_extras/diagnose_data.rb', line 20 def call [ :table_cache_hit, :index_cache_hit, :unused_indexes, :null_indexes, :bloat, :duplicate_indexes ].yield_self do |checks| extensions_data = query_module.extensions(in_format: :hash) pg_stats_enabled = extensions_data.find do |el| el.fetch("name") == "pg_stat_statements" end.fetch("installed_version", false) ssl_info_enabled = extensions_data.find do |el| el.fetch("name") == "sslinfo" end.fetch("installed_version", false) if pg_stats_enabled checks = checks.concat([:outliers]) end if ssl_info_enabled checks = checks.concat([:ssl_used]) end checks end.map do |check| send(check).merge(check_name: check) end end |