Re: Records Number

From: Richard Huxton <dev(at)archonet(dot)com>
To: info(at)enricopirozzi(dot)info
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Records Number
Date: 2009-03-17 12:26:34
Message-ID: 49BF96FA.3020905@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Enrico Pirozzi wrote:
> and i would like to retrieve the number of records without make
>
> select count(*) from table
>
> I could use directly the table instead of select, and in this this
> case I'm searching for
> something like the reltuples field in the pg_class table, but I need
> this value in real time.

If you want an accurate, up-to-date count then you'll need to use
count(*) or have a trigger keep a summary-count for you. A simple
implementation will reduce concurrency to writes on that table however.
Lots of discussion in the mailing-list archives on this.

--
Richard Huxton
Archonet Ltd

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Richard Huxton 2009-03-17 12:30:47 Re: Escaping special characters
Previous Message Neanderthelle Jones 2009-03-17 12:05:20 Escaping special characters