Track historical space stats in PgHero to determine PostgreSQL growth (#8906)
parent
d4b7d75968
commit
7f9dd92a27
@ -0,0 +1,11 @@ |
|||||||
|
# frozen_string_literal: true |
||||||
|
|
||||||
|
class Scheduler::PgheroScheduler |
||||||
|
include Sidekiq::Worker |
||||||
|
|
||||||
|
sidekiq_options unique: :until_executed, retry: 0 |
||||||
|
|
||||||
|
def perform |
||||||
|
PgHero.capture_space_stats |
||||||
|
end |
||||||
|
end |
@ -0,0 +1,13 @@ |
|||||||
|
class CreatePgheroSpaceStats < ActiveRecord::Migration[5.2] |
||||||
|
def change |
||||||
|
create_table :pghero_space_stats do |t| |
||||||
|
t.text :database |
||||||
|
t.text :schema |
||||||
|
t.text :relation |
||||||
|
t.integer :size, limit: 8 |
||||||
|
t.timestamp :captured_at |
||||||
|
end |
||||||
|
|
||||||
|
add_index :pghero_space_stats, [:database, :captured_at] |
||||||
|
end |
||||||
|
end |
Loading…
Reference in new issue