Skip to content

Commit a96b38b

Browse files
committed
Add missing useful columns in vacuum_stats.sql
1 parent f05f3ff commit a96b38b

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

lib/ruby_pg_extras/queries/vacuum_io_stats.sql

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ SELECT
1515
fsyncs,
1616
fsync_time,
1717
reuses,
18-
evictions
18+
evictions,
19+
stats_reset
1920
FROM
2021
pg_stat_io
2122
WHERE

lib/ruby_pg_extras/queries/vacuum_stats.sql

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Dead rows and whether an automatic vacuum is expected to be triggered */
1+
/* Dead rows, new inserts since last VACUUM and whether an automatic vacuum is expected to be triggered */
22

33
WITH table_opts AS (
44
SELECT
@@ -34,8 +34,10 @@ WITH table_opts AS (
3434
SELECT
3535
vacuum_settings.nspname AS schema,
3636
vacuum_settings.relname AS table,
37-
to_char(psut.last_vacuum, 'YYYY-MM-DD HH24:MI') AS last_vacuum,
37+
to_char(psut.last_vacuum, 'YYYY-MM-DD HH24:MI') AS last_manual_vacuum,
38+
to_char(psut.vacuum_count, '9G999G999G999') AS manual_vacuum_count,
3839
to_char(psut.last_autovacuum, 'YYYY-MM-DD HH24:MI') AS last_autovacuum,
40+
to_char(psut.autovacuum_count, '9G999G999G999') AS autovacuum_count,
3941
to_char(pg_class.reltuples, '9G999G999G999') AS rowcount,
4042
to_char(psut.n_dead_tup, '9G999G999G999') AS dead_rowcount,
4143
to_char(

0 commit comments

Comments
 (0)