Re: How can I find out the space used on disk for a table/index

From: Andres Freund <andres(at)anarazel(dot)de>
To: pgsql-general(at)postgresql(dot)org
Cc: Viktor Rosenfeld <rosenfel(at)informatik(dot)hu-berlin(dot)de>
Subject: Re: How can I find out the space used on disk for a table/index
Date: 2009-07-12 19:45:09
Message-ID: 200907122145.10033.andres@anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sunday 12 July 2009 21:07:56 Viktor Rosenfeld wrote:
> Hi,
>
> I want to judge the performance gain of additional indexes against the
> space they consume on disk. Currently I do a VACUUM FULL ANALYZE and
> then take the space used by the base directory and do some
> calculations. This is time consuming, error-prone and unreliable.
>
> Is there a quick way to compute the space used on disk by an index (in
> MB or blocks) using the statistics tables?
Read the manual:
http://www.postgresql.org/docs/current/static/functions-admin.html#FUNCTIONS-
ADMIN-DBSIZE

e.g. SELECT pg_size_pretty(pg_index_size('indexname'));

Using the system tables you can easily do that for all indices in your
database.

Andres

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Scott Bailey 2009-07-12 19:48:12 Re: Postgresql databases as a web service
Previous Message Scott Marlowe 2009-07-12 19:17:50 Re: Postgresql databases as a web service