| From: | Artem Tomyuk <admin(at)leboutique(dot)com> | 
|---|---|
| To: | depesz(at)depesz(dot)com | 
| Cc: | pgsql-admin(at)postgresql(dot)org | 
| Subject: | Re: Finding the size of your biggest relations | 
| Date: | 2016-09-23 13:31:39 | 
| Message-ID: | CANYYVqKF83n76cD3+SGZkOBWVOytMmVun72a_vm_euYw1CdbjA@mail.gmail.com | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-admin | 
Sorry,
this query
SELECT nspname || '.' || relname AS "relation",
    pg_size_pretty(pg_total_relation_size(C.oid)) AS "total_size"
  FROM pg_class C
  LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace)
  WHERE nspname NOT IN ('pg_catalog', 'information_schema')
    AND C.relkind <> 'i'
    AND nspname !~ '^pg_toast'
  ORDER BY pg_total_relation_size(C.oid) DESC
  LIMIT 20;
2016-09-23 16:21 GMT+03:00 hubert depesz lubaczewski <depesz(at)depesz(dot)com>:
> On Fri, Sep 23, 2016 at 03:57:52PM +0300, Artem Tomyuk wrote:
> > i am running this query to get to 20 biggest tables but getting only
> > pg_temp** records like this without size:
>
> What query did you run?
>
> For finding largest tables, I use:
>
> select oid::regclass, pg_table_size(oid) from pg_class where relkind
> = 'r' order by 2 desc limit 20;
>
> Best regards,
>
> depesz
>
>
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Jan-Peter Seifert | 2016-09-23 14:07:30 | Recommended cluster locale (initdb)? | 
| Previous Message | hubert depesz lubaczewski | 2016-09-23 13:21:23 | Re: Finding the size of your biggest relations |