Re: Row counts/data changes. Any catalog table that has this info? - Mailing list pgsql-sql

From Josh Berkus
Subject Re: Row counts/data changes. Any catalog table that has this info?
Date
Msg-id 200402201053.36242.josh@agliodbs.com
Whole thread Raw
In response to Row counts/data changes. Any catalog table that has this info?  ("David B" <postgresql@thegatelys.com>)
List 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 BerkusAglio Database SolutionsSan Francisco



pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: Creating constraint sometime fail in a transaction
Next
From: Brian Knox
Date:
Subject: Re: Date Foo.