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

From: Greg Stark <gsstark(at)mit(dot)edu>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: pgsql-general(at)postgresql(dot)org, 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 23:53:49
Message-ID: 407d949e0907121653t64fbf994j6fca7796e76749b1@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sun, Jul 12, 2009 at 8:45 PM, Andres Freund<andres(at)anarazel(dot)de> wrote:
> 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.

Also counter-productive since vacuum full actually causes indexes to
grow, not shrink.

As Andres said, use the pg_*_size functions. You may also want to run
a regular vacuum verbose and use the number of pages from that. That
would have the side benefit of giving you an idea of how densely
packed or bloated each index is which may be a factor in measuring
performance.

--
greg
http://mit.edu/~gsstark/resume.pdf

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Andreas 2009-07-13 01:01:56 how drop a role that owns stuff ?
Previous Message Tom Lane 2009-07-12 22:31:05 Re: Rule acting as REPLACE INTO behave strange