Re: Psql command for rowcount - Mailing list pgsql-general

From David Wilson
Subject Re: Psql command for rowcount
Date
Msg-id e7f9235d0809111238i5b0838bbpbdf7f0f3e53484d9@mail.gmail.com
Whole thread Raw
In response to Psql command for rowcount  ("Markova, Nina" <nmarkova@NRCan.gc.ca>)
Responses Re: Psql command for rowcount
List pgsql-general
On Thu, Sep 11, 2008 at 3:19 PM, Markova, Nina <nmarkova@nrcan.gc.ca> wrote:
> Is there a psql or other command that I can use to list tables and their
> rows? All I found is this:
> http://archives.postgresql.org/pgsql-hackers/2004-09/msg00876.php

select tablename,reltuples from pg_class inner join pg_tables on
tablename=relname where tablename !~* 'pg_*' and tablename !~*
'sql_*';

Remember that the reltuples count is an *estimate* and won't be 100%
an accurate- only a count(*) will get you that.

--
- David T. Wilson
david.t.wilson@gmail.com

pgsql-general by date:

Previous
From: hubert depesz lubaczewski
Date:
Subject: Re: index on id and created_at
Next
From: "Gauthier, Dave"
Date:
Subject: Re: connection timeouts and "killing" users