List all tables in your database - largest first - largest by no of relpages

posted Nov 10, 2014, 5:22 PM by Sachchida Ojha   [ updated Nov 10, 2014, 5:25 PM ]
The gadget spec URL could not be found
The gadget spec URL could not be found
SELECT 
n.nspname AS schemaname, 
c.relname AS tablename,
c.relpages,
c. reltuples,  
pg_get_userbyid(c.relowner) AS tableowner, 
t.spcname AS tablespace, 
c.relhasindex AS hasindexes, 
c.relhasrules AS hasrules, 
c.reltriggers > 0 AS hastriggers
FROM pg_class c
LEFT JOIN pg_namespace n ON n.oid = c.relnamespace
LEFT JOIN pg_tablespace t ON t.oid = c.reltablespace
WHERE c.relkind = 'r'::"char"
order by c.relpages desc;

The gadget spec URL could not be found
The gadget spec URL could not be found
Comments