SELECT relname, pg_size_pretty ( pg_relation_size(relname::text) ) AS size
FROM pg_class
INNER JOIN pg_namespace ON pg_class.relnamespace = pg_namespace.oid AND pg_namespace.nspname = 'public';
select pg_relation_size('テーブル名') as テーブル名, pg_relation_size('テーブル名') as テーブル名;
select pg_table_size('テーブル名') as テーブル名, pg_table_size('テーブル名') as テーブル名;
pg_relation_size() = pg_table_size() + pg_indexes_size()
select pg_database_size('データベース名');
select pg_indexes_size('テーブル名') as テーブル名, pg_indexes_size('テーブル名') as テーブル名;
SELECT datname, xact_commit, xact_rollback FROM pg_stat_database;