Re: rowcount for all tables

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Stefan Meyer <st(dot)meyer(at)mdsi(dot)de>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: rowcount for all tables
Date: 2006-03-19 04:56:52
Message-ID: 20060319045652.GA14031@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Fri, Mar 17, 2006 at 14:39:04 +0100,
Stefan Meyer <st(dot)meyer(at)mdsi(dot)de> wrote:
> i have a beginner question and i have read the FAQs.
> is there a faster ways than
>
> select count(*) from foo;
>
> to get the rowcount for the tables in my db ?

There are some ways to get approximate counts that won't require scanning
the whole table.

If you are going to be doing lots of these, you can use triggers to
maintain a count. There is also a more complicated approach that can be
used to reduce contention. You should be able to find more details in
the archives.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Svenne Krap 2006-03-19 13:26:44 How to call table returning function with other table
Previous Message Jeff Frost 2006-03-19 02:21:39 Re: update before drop causes OID problems in transaction?