Skip to content

Commit de70dca

Browse files
committed
updated postgres_last_vacuum.sql
1 parent 46eb2bc commit de70dca

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

postgres_last_vacuum.sql

+14-14
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,20 @@
2020
-- Tested on PostgreSQL 9.1+, 10.x, 11.x, 12.x, 13.0
2121

2222
SELECT
23-
schemaname,
24-
relname,
25-
n_live_tup,
26-
n_dead_tup,
27-
n_dead_tup / GREATEST(n_live_tup + n_dead_tup, 1)::float * 100 AS dead_percentage,
28-
last_vacuum,
29-
last_autovacuum,
30-
-- not available on PostgreSQL <= 9.0
31-
vacuum_count,
32-
autovacuum_count
23+
schemaname,
24+
relname,
25+
n_live_tup,
26+
n_dead_tup,
27+
n_dead_tup / GREATEST(n_live_tup + n_dead_tup, 1)::float * 100 AS dead_percentage,
28+
last_vacuum,
29+
last_autovacuum,
30+
-- not available on PostgreSQL <= 9.0
31+
vacuum_count,
32+
autovacuum_count
3333
FROM pg_stat_user_tables
3434
WHERE
35-
n_dead_tup > 0
35+
n_dead_tup > 0
3636
ORDER BY
37-
n_dead_tup DESC,
38-
last_vacuum DESC,
39-
last_autovacuum DESC;
37+
n_dead_tup DESC,
38+
last_vacuum DESC,
39+
last_autovacuum DESC;

0 commit comments

Comments
 (0)