Sure, thanks for the response Michael. I appreciate any help you can provide.
FVDM=# SELECT nspname || '.' || relname AS "relation", pg_size_pretty(pg_total_relation_size(C.oid)) AS "size"
FROM pg_class C
LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace)
WHERE nspname NOT IN ('pg_catalog', 'information_schema')
ORDER BY pg_relation_size(C.oid) DESC
LIMIT 20;
relation | size
------------------------------------------------------+---------
mart.pms_***** | 301 MB
mart.detailed_***** | 66 MB
mart.major_***** | 58 MB
public.temp_***** | 20 MB
public.temp_***** | 13 MB
mart.customer_***** | 11 MB
public.temp_***** | 11 MB
mart.major_***** | 1888 kB
public.temp_*****t | 1880 kB
public.hold_***** | 1424 kB
public.temp_***** | 1208 kB
mart.ranking_***** | 1144 kB
public.temp_***** | 1080 kB
public.temp_***** | 984 kB
mart.customer_***** | 456 kB
public.hold_***** | 448 kB
mart.expanded_***** | 384 kB
pg_toast.pg_toast_2618 | 392 kB
public.temp_***** | 232 kB
(20 rows)
FVDM=# SELECT nspname || '.' || relname AS "relation",
pg_size_pretty(pg_total_relation_size(C.oid)) AS "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.relname ~* 'toast'
ORDER BY pg_relation_size(C.oid) DESC
LIMIT 20;
relation | size
-------------------------------+------------
pg_toast.pg_toast_2618 | 392 kB
pg_toast.pg_toast_2619 | 88 kB
pg_toast.pg_toast_2618_index | 16 kB
pg_toast.pg_toast_2619_index | 16 kB
pg_toast.pg_toast_13104_index | 8192 bytes
pg_toast.pg_toast_3596_index | 8192 bytes
pg_toast.pg_toast_2606_index | 8192 bytes
pg_toast.pg_toast_2620_index | 8192 bytes
pg_toast.pg_toast_2609_index | 8192 bytes
pg_toast.pg_toast_2396_index | 8192 bytes
pg_toast.pg_toast_3592_index | 8192 bytes
pg_toast.pg_toast_1255_index | 8192 bytes
pg_toast.pg_toast_13109_index | 8192 bytes
pg_toast.pg_toast_13114_index | 8192 bytes
pg_toast.pg_toast_13119_index | 8192 bytes
pg_toast.pg_toast_13124_index | 8192 bytes
pg_toast.pg_toast_13129_index | 8192 bytes
pg_toast.pg_toast_13134_index | 8192 bytes
pg_toast.pg_toast_2604_index | 8192 bytes
pg_toast.pg_toast_2964_index | 8192 bytes
(20 rows)
--
Jeremiah From: MichaelDBA <MichaelDBA@xxxxxxxxxxx>
Sent: Friday, February 8, 2019 12:12 PM To: Vijaykumar Jain Cc: Jeremiah Bauer; pgsql-admin@xxxxxxxxxxxxxxxxxxxx Subject: Re: [External] Postgres Database Disk Usage Would you use pg_total_relation_size, not pg_relation_size in your sizing query? This will capture associated indexes and such.
CONFIDENTIALITY NOTICE: The information contained in this email (and any attachments) is privileged and confidential and protected from disclosure. If you are not the intended recipient of this email or the attachments, be aware that any disclosure, copying,
distribution or use of this email or any attachment is strictly prohibited and you should not read the message or read or open any attachment. If you have received this email by mistake, please immediately notify the sender and delete it permanently from your
system. Agri Stats, Inc. and its subsidiaries will not be held liable to any person or entity resulting from the unintended or unauthorized use of any information contained in this email.
Regards, Michael Vitale
|