SQL to list Schema Objects in Greenplum
-- List Schema Objects with type and storage class
SELECT b.nspname , relname, c.relkind,c.relstorage FROM pg_class c,pg_namespace b
WHERE c.relnamespace=b.oid and b.nspname NOT IN ('gp_toolkit', 'information_schema', 'pg_catalog','pg_aoseg','pg_toast')
ORDER BY b.nspname,c.relkind,c.relstorage;
-- List tables order by no of rows in the tables
SELECT N.oid, nspname AS schemaname,relname,to_char(reltuples,'99G999G999999')
FROM pg_class C LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace)
WHERE nspname NOT IN ('pg_catalog', 'information_schema') AND relkind='r'
--and relname='sachitabletest'
ORDER BY reltuples DESC;