Re: How do you find the row count for all your tables in Postgres?

From: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
To: Nithya Soman <nithya(at)quintetsolutions(dot)com>
Cc: PostgreSQL mailing lists <pgsql-general(at)postgresql(dot)org>
Subject: Re: How do you find the row count for all your tables in Postgres?
Date: 2014-04-07 22:44:58
Message-ID: CAB7nPqRWj1VX49hULXxr_g=g+PxtAPBgGBPZz6gDcer2ZxgAgw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Apr 7, 2014 at 6:46 PM, Nithya Soman
<nithya(at)quintetsolutions(dot)com> wrote:
> How can we find the total row count for all db tables in psql version 7.4.3
> ??
Are you aware that 7.4 is EOL for 5 years? 7.4.3 is missing as well at
least 4 years of bug fixes in its stable branch.

> The query which worked fine in psql 9.2 version is :
> SELECT schemaname,relname,n_live_tup FROM pg_stat_user_tables ORDER BY
> n_live_tup DESC.
> But same query throws error as 'ERROR: column "n_live_tup" does not exist'
> in psql 7.4.30. Could you please provide a valid query to get row count for
> all db tables in psql 7.4.3 ?
The documentation of 7.4 does not mention explicitely what are the
columns of this view, but connecting to a 7.4 server and issuing "¥d
pg_stat_user_tables" would help and you might be able to get an
equivalent of what you are trying to do.
--
Michael

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Stefan Keller 2014-04-07 22:46:37 Re: Postgres as In-Memory Database?
Previous Message Rebecca Clarke 2014-04-07 22:28:11 Re: Initial queries of day slow