Re: select items, and max id

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: "Luis H(dot)" <pgsql-novice(at)geekhouse(dot)no-ip(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: select items, and max id
Date: 2003-08-29 02:57:07
Message-ID: 20030829025707.GE4373@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Thu, Aug 28, 2003 at 22:46:26 -0400,
"Luis H." <pgsql-novice(at)geekhouse(dot)no-ip(dot)com> wrote:
> Thanks for the info. I just realized I had thought out the logic of my web
> app in the wrong way. I will now be working with the number of items in the
> table. I know there is a count() query, and earlier someone asked for a
> better solution (that doesn't need to cycle through the table). Tom Lane
> mentioned pg_class.reltuples, but said it wasn't a completely accurate
> measure. Any suggestions?

If you need an exact number you either have to count the number of records
in the table that match your critera or you need to maintain counts
somewhere. The cost of maintaining the counts can potentially be high so
it won't necessarily be better to do it that way.

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Nabil Sayegh 2003-08-29 02:59:14 Re: select items, and max id
Previous Message Luis H. 2003-08-29 02:46:26 Re: select items, and max id