Re: Row counts/data changes. Any catalog table that has this info?

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: "David B" <postgresql(at)thegatelys(dot)com>, <pgsql-sql(at)postgresql(dot)org>
Subject: Re: Row counts/data changes. Any catalog table that has this info?
Date: 2004-02-20 18:53:36
Message-ID: 200402201053.36242.josh@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice pgsql-sql

David,

> table_name #Rows
> cust 1000
> order 5000
> order_detail 9500

If you're willing to live with some inaccuracy, do:

SELECT relname, reltuples FROM pg_class
WHERE relkind='r';

This count gets updated when you do a VACUUM, and is seldom 100% accurate;
however, if you VACUUM regularly it will be within 5-10%.

--
-Josh Berkus
Aglio Database Solutions
San Francisco

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Josh Berkus 2004-02-20 18:55:50 Re: pg_hba.conf problem
Previous Message beyaNet Consultancy 2004-02-20 15:22:50 Binary retrieval - *Best practice* recommendations...

Browse pgsql-sql by date

  From Date Subject
Next Message Brian Knox 2004-02-20 20:25:36 Re: Date Foo.
Previous Message Tom Lane 2004-02-20 16:37:13 Re: Creating constraint sometime fail in a transaction