@@ -4,9 +4,7 @@ with data as (
44 from pg_stat_database s
55 where s .datname = current_database()
66)
7- select ' Database Name' as metric, datname as value from data
8- union all
9- select ' Database Version' as metric, version() as value
7+ select ' Postgres Version' as metric, version() as value
108union all
119select
1210 ' Role' as metric,
@@ -20,17 +18,32 @@ select
2018 else ' Master'
2119 end as value
2220union all
21+ select ' Database Name' as metric, datname as value from data
22+ union all
2323select ' Database Size' , pg_catalog .pg_size_pretty (pg_catalog .pg_database_size (current_database()))
2424union all
25+ select ' Installed Extensions' , (
26+ with exts as (
27+ select extname || ' (' || extversion || ' )' e, (- 1 + row_number() over (order by extname)) / 5 i from pg_extension
28+ ), lines(l) as (
29+ select string_agg(e, ' , ' order by i) l from exts group by i
30+ )
31+ select string_agg(l, e' \n ' ) from lines
32+ )
33+ union all
2534select ' Cache Effectiveness' , (round(blks_hit * 100 ::numeric / (blks_hit + blks_read), 2 ))::text || ' %' from data
2635union all
2736select ' Successful Commits' , (round(xact_commit * 100 ::numeric / (xact_commit + xact_rollback), 2 ))::text || ' %' from data
2837union all
2938select ' Conflicts' , conflicts::text from data
3039union all
31- select ' Temp Files: total size (total number of files)' , (pg_size_pretty(temp_bytes)::text || ' (' || temp_files::text || ' )' ) from data
40+ select ' Temp Files: total size' , pg_size_pretty(temp_bytes)::text from data
41+ union all
42+ select ' Temp Files: total number of files' , temp_files::text from data
3243union all
3344select ' Deadlocks' , deadlocks::text from data
3445union all
35- select ' Stat Since' , stats_reset::text from data
46+ select ' Stats Since' , stats_reset::timestamptz (0 )::text from data
47+ union all
48+ select ' Stats Age' , (now() - stats_reset)::interval (0 )::text from data
3649;
0 commit comments