Re: Psql command for rowcount

From: "David Wilson" <david(dot)t(dot)wilson(at)gmail(dot)com>
To: "Markova, Nina" <nmarkova(at)nrcan(dot)gc(dot)ca>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Psql command for rowcount
Date: 2008-09-11 19:38:43
Message-ID: e7f9235d0809111238i5b0838bbpbdf7f0f3e53484d9@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Sep 11, 2008 at 3:19 PM, Markova, Nina <nmarkova(at)nrcan(dot)gc(dot)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(dot)t(dot)wilson(at)gmail(dot)com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Gauthier, Dave 2008-09-11 20:27:50 Re: connection timeouts and "killing" users
Previous Message hubert depesz lubaczewski 2008-09-11 19:27:42 Re: index on id and created_at