From 72db60a03cb724851abed92f3098e04bfd662c8d Mon Sep 17 00:00:00 2001 From: Diego Date: Mon, 4 Sep 2023 10:52:07 +0200 Subject: [PATCH] Adjust days calc for compatibility --- sql/AutoVacuum/large_tables_non_autovacuumed.sql | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/sql/AutoVacuum/large_tables_non_autovacuumed.sql b/sql/AutoVacuum/large_tables_non_autovacuumed.sql index dae3fea..50d99b5 100644 --- a/sql/AutoVacuum/large_tables_non_autovacuumed.sql +++ b/sql/AutoVacuum/large_tables_non_autovacuumed.sql @@ -5,14 +5,14 @@ select pg_size_pretty(pg_total_relation_size(('"'||schemaname||'"."'||relname||'"')::regclass)) as rank_size, rank() over ( order by pg_total_relation_size(('"'||schemaname||'"."'||relname||'"')::regclass) desc), n_dead_tup, - -- n_dead_tup / extract('days' from clock_timestamp()-last_vacuum) as dead_by_day, - -- extract('days' from clock_timestamp()-last_vacuum) as last_vacuum, - extract('days' from clock_timestamp()-last_autovacuum) as last_autovacuum, - -- extract('days' from clock_timestamp()-last_analyze) as last_analyze, - extract('days' from clock_timestamp()-last_autoanalyze) as last_autoanalyze, - -- vacuum_count, + -- n_dead_tup / now()-last_vacuum) as dead_by_day, + now()-last_vacuum as last_vacuumdays, + now()-last_autovacuum as last_autovacuumdays, + now()-last_analyze as last_analyzedays, + now()-last_autoanalyze as last_autoanalyzedays, + vacuum_count, autovacuum_count, - -- analyze_count, + analyze_count, autoanalyze_count from pg_stat_user_tables order by n_dead_tup desc, pg_relation_size(('"'||schemaname||'"."'||relname||'"')::regclass) desc;