Determining table size

Started by Claudio Lapidusalmost 23 years ago4 messagesgeneral
Jump to latest
#1Claudio Lapidus
clapidus@hotmail.com

Hello

Is there a way to find out how much disk space is taking a certain table? Or
a whole database?

TIA,
cl.

_________________________________________________________________
Add photos to your messages with MSN 8. Get 2 months FREE*.
http://join.msn.com/?page=features/featuredemail

#2Hubert Lubaczewski
hubert.lubaczewski@eo.pl
In reply to: Claudio Lapidus (#1)
Re: Determining table size

On Wed, 25 Jun 2003 03:28:29 -0300
"Claudio Lapidus" <clapidus@hotmail.com> wrote:

Is there a way to find out how much disk space is taking a certain table? Or
a whole database?

sure
just use dbsize module from contrib.

depesz

#3Yusuf
yusuf0478@netscape.net
In reply to: Hubert Lubaczewski (#2)
Re: Determining table size

I usually do the following:

for table tbl: select relpages * 8 from pg_class where relname = 'tbl' (This would give you an answer in KB)
for a db: select sum(relpages)* 8 from pg_class where relname not like 'pg_%'

#4Bruce Momjian
bruce@momjian.us
In reply to: Hubert Lubaczewski (#2)
Re: Determining table size

There is a Monitoring Disk Space section in the 7.3 docs.

---------------------------------------------------------------------------

Hubert Lubaczewski wrote:

On Wed, 25 Jun 2003 03:28:29 -0300
"Claudio Lapidus" <clapidus@hotmail.com> wrote:

Is there a way to find out how much disk space is taking a certain table? Or
a whole database?

sure
just use dbsize module from contrib.

depesz

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to majordomo@postgresql.org)

-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073