Skip site navigation (1) Skip section navigation (2)

Re: database row count

From: Carol Cheung <cacheung(at)consumercontact(dot)com>
To:
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: database row count
Date: 2008-01-30 21:14:29
Message-ID: 47A0E8B5.2020404@consumercontact.com (view raw or flat)
Thread:
Lists: pgsql-novice
On 30/01/2008 15:10, Isaac Vetter wrote the following:
> Dear Pg experts;
> 
> I'd like to get a (rough) count of the numbers of rows across all tables 
> in a given database.
> 
> I understand that I could write a script to run count(*) on each table 
> and then sum the counts. Is there an easier way, has someone already 
> written this script?
> 
> Much Thanks,
> 
> Isaac Vetter

How about

SELECT relname, reltuples FROM pg_class WHERE relname IN (...);

In response to

Responses

pgsql-novice by date

Next:From: Jonah H. HarrisDate: 2008-01-30 21:19:50
Subject: Re: database row count
Previous:From: Isaac VetterDate: 2008-01-30 20:10:50
Subject: database row count

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group