table disk space usage query?

From: lawpoop(at)gmail(dot)com
To: pgsql-general(at)postgresql(dot)org
Subject: table disk space usage query?
Date: 2007-06-28 17:31:31
Message-ID: 1183051891.044658.38930@q69g2000hsb.googlegroups.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello all -

I was looking for a way to find out how much disk space each table is
using.

I stumbled upon this page ( http://www.ffnn.nl/pages/articles/linux/postgresql-tips-and-tricks.php
) which gave me a query to show the number of disk pages per object.
Given that a page is 8kb, I added these calculated columns to the
query:

SELECT relname, reltuples, relpages,
relpages * 8 AS relpagesKB,
(relpages * 8 )/1024 AS relpagesMB
FROM pg_class ORDER BY relpages DESC ;

Is this correct?

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Mario Jose Canto Barea 2007-06-28 17:47:17 i need a rad/ide open source for work with postgresql
Previous Message Pouria 2007-06-28 17:14:32 installing pljava on windows xp