From: Paul Lambert <paul.lambert@autoledgers.com.au>
To: pgsql-sql@postgresql.org
Subject: Count of rows
Date: Fri, 03 Aug 2007 13:35:26 +0800
Message-ID: <46B2BE9E.8010202@autoledgers.com.au> (raw)
What's the best way to count how many rows are in each table via SQL? Or
is it even possible?
I'm trying something like:
select tablename, count(*) from (select tablename from pg_tables where
schemaname = 'public') as test group by tablename;
But obviously this just gives a count of 1 for each table in the public
schema.
Can it be done or would I have to write a function?
--
Paul Lambert
Database Administrator
AutoLedgers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: paul.lambert@autoledgers.com.au
Subject: Re: Count of rows
In-Reply-To: <46B2BE9E.8010202@autoledgers.com.au>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox