Re: PL/PgSQL for counting all rows in all tables.

From: "Dave Page" <dpage(at)vale-housing(dot)co(dot)uk>
To: "Robert Treat" <xzilla(at)users(dot)sourceforge(dot)net>
Cc: <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: PL/PgSQL for counting all rows in all tables.
Date: 2004-10-12 07:22:30
Message-ID: E7F85A1B5FF8D44C8A1AF6885BC9A0E4306AEB@ratbert.vale-housing.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> -----Original Message-----
> From: Robert Treat [mailto:xzilla(at)users(dot)sourceforge(dot)net]
> Sent: 11 October 2004 22:30
> To: Dave Page
> Cc: pgsql-hackers(at)postgresql(dot)org
> Subject: Re: [HACKERS] PL/PgSQL for counting all rows in all tables.
>
> How do you handle table growth that makes the reltuples value
> out of whack since the last analyze? Seems unfortunate that
> people may not realize that the numbers they are looking at
> are incorrect but I don't see much way to avoid it.

Right-click the table object and select 'Count' on the current versions.
Previously, iirc it showed the message 'Refresh table to count' in the
actual count field, so you did a right-click -> Refresh.

> Seems new tables would have that problem too since they would
> default to 1000... do you analyze after table creation?

No. 1000 is below the default threshold, so it'll get counted. If you
lower the threshold, it will say 'not counted' in the actual count
field.

Regards, Dave.

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2004-10-12 07:51:06 Re: open item: tablespace handing in pg_dump/pg_restore
Previous Message Peter Eisentraut 2004-10-12 06:56:14 Re: Making rpath a bit more flexible