From 0f356a9b79d769f2d39a0c491f1901d2e4ad1ddc Mon Sep 17 00:00:00 2001 From: David Leutgeb Date: Thu, 8 Aug 2024 10:41:20 +0200 Subject: [PATCH] Update change_settings.md --- change_settings.md | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/change_settings.md b/change_settings.md index aa115b7..743c0b6 100644 --- a/change_settings.md +++ b/change_settings.md @@ -30,4 +30,23 @@ select sourcefile, name,sourceline,error from pg_file_settings where error is no ``` select pg_hba_file_rules(); -``` \ No newline at end of file +``` + +## Check vacuuming and autovacuuming date for tables per database + +Switch to the desired database and then you run this query to see the vaccum status. + +``` +SELECT + schemaname, + relname, + last_vacuum, + last_autovacuum, + n_dead_tup +FROM + pg_stat_all_tables +WHERE + schemaname NOT IN ('pg_catalog', 'information_schema') +ORDER BY + n_dead_tup DESC; +```