Sha256: af64227cb4ec69cc5b8c70774587f3cf5c614a1f81b8becbcd23840563644361

Contents?: true

Size: 1.04 KB

Versions: 10

Compression:

Stored size: 1.04 KB

Contents

namespace :pghero do
  desc "Capture query stats"
  task capture_query_stats: :environment do
    PgHero.capture_query_stats(verbose: true)
  end

  desc "Capture space stats"
  task capture_space_stats: :environment do
    PgHero.capture_space_stats(verbose: true)
  end

  desc "Analyze tables"
  task analyze: :environment do
    PgHero.analyze_all(verbose: true, min_size: ENV["MIN_SIZE_GB"].to_f.gigabytes)
  end

  desc "Autoindex tables"
  task autoindex: :environment do
    PgHero.autoindex_all(verbose: true, create: true)
  end

  desc "Remove old query stats"
  task clean_query_stats: :environment do
    puts "Deleting old query stats..."
    options = {}
    options[:before] = Float(ENV["KEEP_DAYS"]).days.ago if ENV["KEEP_DAYS"].present?
    PgHero.clean_query_stats(**options)
  end

  desc "Remove old space stats"
  task clean_space_stats: :environment do
    puts "Deleting old space stats..."
    options = {}
    options[:before] = Float(ENV["KEEP_DAYS"]).days.ago if ENV["KEEP_DAYS"].present?
    PgHero.clean_space_stats(**options)
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
pghero-3.6.1 lib/tasks/pghero.rake
pghero-3.6.0 lib/tasks/pghero.rake
pghero-3.4.1 lib/tasks/pghero.rake
pghero-3.4.0 lib/tasks/pghero.rake
pghero-3.3.4 lib/tasks/pghero.rake
pghero-3.3.3 lib/tasks/pghero.rake
pghero-3.3.2 lib/tasks/pghero.rake
pghero-3.3.1 lib/tasks/pghero.rake
pghero-3.3.0 lib/tasks/pghero.rake
pghero-3.2.0 lib/tasks/pghero.rake