table and index size

From: Damon Fasching <fasching(at)design(dot)lbl(dot)gov>
To: pgsql-general(at)postgresql(dot)org
Subject: table and index size
Date: 2002-07-15 06:45:05
Message-ID: Pine.SOL.3.96.1020714232200.16449B-100000@design.lbl.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


Is there a way to determine the size of a table? an index?
I didn't see anything in the reference manual about this so just did a
'du' before and after creating and populating a table and then again after
creating an index on the table. The numbers I got were shockingly low.

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.

One of the columns had values ranging from 0 to 3. The other had random
32 bit integers. Making an index (btree) on either column used an
additional 1.8 KB, or .14 bits per row.

These numbers were a little surprising, so I du'ed / to see if the data
was being hidden somewhere, and got the same differences.

So, I guess there are two questions here.

1) Do these numbers seem reasonable to someone with a little more
Postgresql experience?

2) Are there commands to determine directly the size of a database, a
table and an index?

One further question, if anyone can comment. I have the New Riders
PostgreSQL Essential Reference book. It claims that in my database
directory I should find some files with plain text names. As an example
they say that "$PGBASE/payroll_idx" is the name of the payroll index file.
All of the files in my database directory have opaque names like
"$PGBASE/16555/16475". Is there a way to generate more human filenames or
is the New Riders book just off base on this?

Thanks,
Damon

---------

May the lights in The Land of Plenty
shine on the Truth some day L Cohen

Browse pgsql-general by date

  From Date Subject
Next Message Damon Fasching 2002-07-15 07:22:44 table and index size
Previous Message Fabrizio 2002-07-15 06:44:39 help (maybe i'm a little stupid)