From 7a46c574307af5629629446f6f9c49e2fcb240fb Mon Sep 17 00:00:00 2001 From: HF Date: Wed, 27 Jul 2022 13:49:52 +0200 Subject: [PATCH] print stats of table sizes --- purge/matrixpurge.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/purge/matrixpurge.sh b/purge/matrixpurge.sh index 14e2b8f..53177d6 100755 --- a/purge/matrixpurge.sh +++ b/purge/matrixpurge.sh @@ -88,4 +88,5 @@ time psql -t postgresql://${SQLUSER}:${SQLPASSWD}@localhost/${SQLDB} -c "VACUUM echo "--DONE. Current database size is..." time psql -t postgresql://${SQLUSER}:${SQLPASSWD}@localhost/${SQLDB} -c "SELECT pg_size_pretty( pg_database_size( 'synapse' ) )" - +[ -n "${BASH_VERSION}" ] && set +H +psql postgresql://${SQLUSER}:${SQLPASSWD}@localhost/${SQLDB} -c "SELECT nspname || '.' || relname AS \"relation\", pg_size_pretty(pg_total_relation_size(c.oid)) AS \"total_size\" FROM pg_class c LEFT JOIN pg_namespace n ON (n.oid = c.relnamespace) WHERE nspname NOT IN ('pg_catalog', 'information_schema') AND c.relkind <> 'i' AND nspname !~ '^pg_toast' ORDER BY pg_total_relation_size(c.oid) DESC LIMIT 20;"