Re: all empty tables

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Garry Saddington <garry(at)schoolteachers(dot)co(dot)uk>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: all empty tables
Date: 2009-11-14 10:54:44
Message-ID: 1258196084.14314.21.camel@vanquo.pezone.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On lör, 2009-11-14 at 10:12 +0000, Garry Saddington wrote:
> How could I list all the tables in a database that do not contain any data?
> I have looked at reltuples but can't quite work out how to use it, any
> pointers would be much apreciated.

select * from pg_class where relkind = 'r' and reltuples = 0; ?

Of course reltuples is only a statistic, not an up to date value, but
the above should be a pretty helpful start to detect possibly useless
tables.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Andreas Kretschmer 2009-11-14 10:57:32 Re: all empty tables
Previous Message Dave Page 2009-11-14 10:52:22 Re: pgday.eu