create view vw_sizes(schema, "table", table_size_mb, indexes_size_mb, total_size_mb, placeholder, table_size_pretty, indexes_size_pretty, total_size_pretty) as
	SELECT n.nspname AS schema,
    c.relname AS "table",
    pg_table_size(c.oid::regclass) / 1024 / 1024 AS table_size_mb,
    pg_indexes_size(c.oid::regclass) / 1024 / 1024 AS indexes_size_mb,
    pg_total_relation_size(c.oid::regclass) / 1024 / 1024 AS total_size_mb,
    ' '::text AS placeholder,
    pg_size_pretty(pg_table_size(c.oid::regclass)) AS table_size_pretty,
    pg_size_pretty(pg_indexes_size(c.oid::regclass)) AS indexes_size_pretty,
    pg_size_pretty(pg_total_relation_size(c.oid::regclass)) AS total_size_pretty
   FROM pg_class c
     LEFT JOIN pg_namespace n ON n.oid = c.relnamespace
  WHERE (n.nspname <> ALL (ARRAY['pg_catalog'::name, 'information_schema'::name])) AND pg_total_relation_size(c.oid::regclass) > (1024 * 1024) AND c.relkind = 'r'::"char"
  ORDER BY (pg_total_relation_size(c.oid::regclass)) DESC
 LIMIT 1000;
