Re: Disk space usage analyzer?

From: "Nicholson, Brad (Toronto, ON, CA)" <bnicholson(at)hp(dot)com>
To: Steve Crawford <scrawford(at)pinpointresearch(dot)com>, Yang Zhang <yanghatespam(at)gmail(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Disk space usage analyzer?
Date: 2011-03-28 16:59:58
Message-ID: 2626AEE4839D064CB0472A3814DC403F46D2C9202C@GVW1092EXB.americas.hpqcorp.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> -----Original Message-----
> From: pgsql-general-owner(at)postgresql(dot)org [mailto:pgsql-general-
> owner(at)postgresql(dot)org] On Behalf Of Steve Crawford
> Sent: Monday, March 28, 2011 12:22 PM
> To: Yang Zhang
> Cc: pgsql-general(at)postgresql(dot)org
> Subject: Re: [GENERAL] Disk space usage analyzer?
>
> On 03/25/2011 07:58 PM, Yang Zhang wrote:
> > Is there any tool for breaking down how much disk space is used by
> > (could be freed by removing) various tables, indexes, selected rows,
> > etc.? Thanks!
> >
>
> You can use the pg_class table and the pg_relation_size (and optionally
> the pg_size_pretty) functions to get that info. This query gives table
> sizes and percent of overall usage.
>
> BUT! It is only looking at tables, not indexes. If you want to know how
> much space will be freed by dropping a table, you will have to modify
> this query to total up the index space used for all the indexes
> associated with each table.

pg_total_relation_size() will give you the size of the table and the indexes on it.

Brad.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Terry Kop 2011-03-28 18:55:27 can a function have a setof (returned from another function) as input
Previous Message Steve Crawford 2011-03-28 16:21:38 Re: Disk space usage analyzer?