Signiant Support

Some Useful Postgres Queries Print


Some queries to get some basic postgres information if you are unable to run a Health Check Report.

GET SIZE OF ALL DATABASES:

SELECT pg_database.datname,
pg_size_pretty(pg_database_size(pg_database.datname)) AS size
FROM pg_database;

GET SIZE OF JUST THE SIGNIANT DATABASE:

SELECT pg_database.datname,
pg_size_pretty(pg_database_size(pg_database.datname)) AS size
FROM pg_database
WHERE pg_database.datname = 'DTM_DB';

GET THE TOP SPACE USERS (note a page is 8K):

select relname,relpages,reltuples from pg_class order by relpages desc;

GET ALL CURRENT ACTIVITY:

select * from pg_stat_activity;

Copyright © 2014 Signiant Inc, all rights reserved.