查看
查看所有数据库大小
SELECT datname AS database_name, pg_size_pretty(pg_database_size(datname)) AS database_size FROM pg_database;
查看数据库中 所有表的大小
SELECT table_name, pg_size_pretty(pg_total_relation_size(quote_ident(table_schema) || '.' || quote_ident(table_name))) AS size
FROM information_schema.tables
WHERE table_type = 'BASE TABLE'
AND table_schema = 'public'
AND table_catalog = 'zabbix2'
ORDER BY pg_total_relation_size(quote_ident(table_schema) || '.' || quote_ident(table_name)) DESC;
完全清空一个表所有内容