Sha256: 39aca5a15f1370c7ba28ef14b237d6d037ddb2e08a0ca88d911d39d80a61605a

Contents?: true

Size: 1.08 KB

Versions: 25

Compression:

Stored size: 1.08 KB

Contents

module PgHero
  module Methods
    module Settings
      def settings
        names =
          if server_version_num >= 90500
            %i(
              max_connections shared_buffers effective_cache_size work_mem
              maintenance_work_mem min_wal_size max_wal_size checkpoint_completion_target
              wal_buffers default_statistics_target
            )
          else
            %i(
              max_connections shared_buffers effective_cache_size work_mem
              maintenance_work_mem checkpoint_segments checkpoint_completion_target
              wal_buffers default_statistics_target
            )
          end
        fetch_settings(names)
      end

      def autovacuum_settings
        fetch_settings %i(autovacuum autovacuum_max_workers autovacuum_vacuum_cost_limit autovacuum_vacuum_scale_factor autovacuum_analyze_scale_factor)
      end

      def vacuum_settings
        fetch_settings %i(vacuum_cost_limit)
      end

      private

      def fetch_settings(names)
        Hash[names.map { |name| [name, select_one("SHOW #{name}")] }]
      end
    end
  end
end

Version data entries

25 entries across 25 versions & 2 rubygems

Version Path
pghero-2.8.3 lib/pghero/methods/settings.rb
pghero-2.8.2 lib/pghero/methods/settings.rb
pghero-2.8.1 lib/pghero/methods/settings.rb
pghero-2.8.0 lib/pghero/methods/settings.rb
pghero-2.7.4 lib/pghero/methods/settings.rb
pghero_fork-2.7.3 lib/pghero/methods/settings.rb
pghero-2.7.3 lib/pghero/methods/settings.rb
pghero-2.7.2 lib/pghero/methods/settings.rb
pghero-2.7.1 lib/pghero/methods/settings.rb
pghero-2.7.0 lib/pghero/methods/settings.rb
pghero-2.6.0 lib/pghero/methods/settings.rb
pghero-2.5.1 lib/pghero/methods/settings.rb
pghero-2.5.0 lib/pghero/methods/settings.rb
pghero-2.4.2 lib/pghero/methods/settings.rb
pghero-2.4.1 lib/pghero/methods/settings.rb
pghero-2.4.0 lib/pghero/methods/settings.rb
pghero-2.3.0 lib/pghero/methods/settings.rb
pghero-2.2.1 lib/pghero/methods/settings.rb
pghero-2.2.0 lib/pghero/methods/settings.rb
pghero-2.1.1 lib/pghero/methods/settings.rb