Skip to content
Snippets Groups Projects
Unverified Commit 7f9dd92a authored by Eugen Rochko's avatar Eugen Rochko Committed by GitHub
Browse files

Track historical space stats in PgHero to determine PostgreSQL growth (#8906)

parent d4b7d759
No related branches found
No related tags found
No related merge requests found
# 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
......@@ -33,3 +33,6 @@
backup_cleanup_scheduler:
cron: '<%= Random.rand(0..59) %> <%= Random.rand(3..5) %> * * *'
class: Scheduler::BackupCleanupScheduler
pghero_scheduler:
cron: '0 0 * * *'
class: Scheduler::PgheroScheduler
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
......@@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord::Schema.define(version: 2018_09_29_222014) do
ActiveRecord::Schema.define(version: 2018_10_07_025445) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
......@@ -372,6 +372,15 @@ ActiveRecord::Schema.define(version: 2018_09_29_222014) do
t.index ["uid"], name: "index_oauth_applications_on_uid", unique: true
end
create_table "pghero_space_stats", force: :cascade do |t|
t.text "database"
t.text "schema"
t.text "relation"
t.bigint "size"
t.datetime "captured_at"
t.index ["database", "captured_at"], name: "index_pghero_space_stats_on_database_and_captured_at"
end
create_table "preview_cards", force: :cascade do |t|
t.string "url", default: "", null: false
t.string "title", default: "", null: false
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment