Skip to content

Instantly share code, notes, and snippets.

@sawirricardo
Last active January 20, 2024 08:41
Show Gist options
  • Save sawirricardo/46672850859b0780132436ebe49f1e01 to your computer and use it in GitHub Desktop.
Save sawirricardo/46672850859b0780132436ebe49f1e01 to your computer and use it in GitHub Desktop.
get all tables postgreSQL
select
c.relname as name,
n.nspname as schema,
pg_total_relation_size (c.oid) as size,
obj_description (c.oid, 'pg_class') as comment
from
pg_class c,
pg_namespace n
where
c.relkind in ('r', 'p')
and n.oid = c.relnamespace
and n.nspname not in ('pg_catalog', 'information_schema')
order by
c.relname;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment