Convenient dump of table and object size in PG 7.4

From: Steve Lane <slane(at)soliantconsulting(dot)com>
To: <pgsql-admin(at)postgresql(dot)org>
Subject: Convenient dump of table and object size in PG 7.4
Date: 2005-05-27 02:39:26
Message-ID: BEBBF290.19D5F%slane@soliantconsulting.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Hello all:

Attached is a view I wrote for postgres 7.4 that seems to provide pretty
accurate reporting of table sizes. For each non-system table in a database
it shows base table size, size of any related TOAST data, and aggregate size
of indexes.

The code is somewhat ugly in that it contains a bunch of CASE statements the
sole point of which is to transform the occasional NULL into a 0.

Object sizes are computed from pg_class.relpages with an assumed page size
of 8192.

Comments and improvements most welcome.

-- sgl

--------
Steve Lane
Vice President
Soliant Consulting, Inc.
(312) 850-3830 (V)
(312) 850-3930 (F)
slane(at)soliantconsulting(dot)com

Attachment Content-Type Size
table_size.txt text/plain 11.9 KB

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Alvaro Herrera 2005-05-27 02:48:12 Re: Convenient dump of table and object size in PG 7.4
Previous Message ASIS Mexico Norte 2005-05-26 22:49:29 Foro Regional Especializado 2005 - Seguridad en el Autotransporte