Re: table row count

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Martin Hurst <martinh(at)ix(dot)netcom(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: table row count
Date: 2003-02-09 06:24:12
Message-ID: 20030209062412.GA17498@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sun, Feb 09, 2003 at 00:08:59 -0500,
Martin Hurst <martinh(at)ix(dot)netcom(dot)com> wrote:
> Is there a way to get the row count of a user table without doing the?
>
> select count(*) from <table>
>
> which can take some time and even do a table scan if the table has millions
> of rows in it.
>
> Are there any system tables or views that hold this value for any given user
> table?

No. If you are going to do lots of counts relative to inserts and deletes,
you can keep the count in another table and create triggers to update it.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ben-Nes Michael 2003-02-09 15:48:30 Re: PostgreSQL x Oracle
Previous Message Tom Lane 2003-02-09 06:11:45 Re: table row count