List all tables in your database - largest first - largest in terms of no or row or tuples

posted Nov 10, 2014, 5:32 PM by Sachchida Ojha
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.reltuples desc;

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