Re: table and index size

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Curt Sampson <cjs(at)cynic(dot)net>
Cc: Damon Fasching <fasching(at)design(dot)lbl(dot)gov>, pgsql-general(at)postgresql(dot)org
Subject: Re: table and index size
Date: 2002-07-15 12:54:43
Message-ID: 15269.1026737683@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Curt Sampson <cjs(at)cynic(dot)net> writes:
> On Mon, 15 Jul 2002, Damon Fasching wrote:
>> Is there a way to determine the size of a table? an index?

> The pg_class table has the size of every object in (usually 8K) pages. So:

> SELECT relname, reltype, relpages, relpages / 128 AS MB
> FROM pg_class
> WHERE relname LIKE 'session%'

Note that those numbers are only up to date if you've vacuumed recently.

>> I created a table with two int4 columns and inserted 100 K rows. The
>> change in disk usage was only 4.3 KBytes, or .17 bits per integer.

> Something's wrong there. Did you sync? 430 KB I'd believe.

I'd believe 4300 KB, but not anything much less than that.
I doubt sync has anything to do with it; I'd wonder whether he
was du'ing the right place with the right privileges. $PGDATA is
normally not readable by anyone except the postgres user...

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2002-07-15 12:58:03 Re: okay so i deleted pg_log .....
Previous Message Phil Dobbin 2002-07-15 12:49:40 Re: OSX Install Instructions