Skip to content

Instantly share code, notes, and snippets.

View svenjr's full-sized avatar

sven svenjr

View GitHub Profile
with table_stats as (
select psut.relname,
psut.n_live_tup,
1.0 * psut.idx_scan / greatest(1, psut.seq_scan + psut.idx_scan) as index_use_ratio
from pg_stat_user_tables psut
order by psut.n_live_tup desc
),
table_io as (
select psiut.relname,
sum(psiut.heap_blks_read) as table_page_read,
@amolpujari
amolpujari / dashboard.rb
Last active March 24, 2021 11:36
activeadmin dashboard with table rows count graph
ActiveAdmin.register_page "Dashboard" do
menu :priority => 1, :label => proc{ I18n.t("active_admin.dashboard") }
content :title => proc{ I18n.t("active_admin.dashboard") } do
# div :class => "blank_slate_container", :id => "dashboard_default_message" do
# span :class => "blank_slate" do
# span "Welcome to Active Admin. This is the default dashboard page."
# small "To add dashboard sections, checkout 'app/admin/dashboards.rb'"
# end