Обсуждение: How do you find the row count for all your tables in Postgres?

Поиск
Список
Период
Сортировка

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

От
Nithya Soman
Дата:
Hi

How can we find the total row count for all db tables in psql version  7.4.3 ??

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 ?


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

От
Michael Paquier
Дата:
On Mon, Apr 7, 2014 at 6:46 PM, Nithya Soman
<nithya@quintetsolutions.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