Re: getting count for a specific querry

From: Ragnar Hafstað <gnari(at)simnet(dot)is>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Joel Fradkin <jfradkin(at)wazagua(dot)com>, pgsql-sql(at)postgresql(dot)org
Subject: Re: getting count for a specific querry
Date: 2005-04-08 16:55:49
Message-ID: 1112979349.7447.42.camel@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Fri, 2005-04-08 at 12:32 -0400, Tom Lane wrote:
> Ragnar =?ISO-8859-1?Q?Hafsta=F0?= <gnari(at)simnet(dot)is> writes:
> > you might reduce the performance loss if your dataset is ordered by
> > a UNIQUE index.
>
> > select * from mytable where somecondition
> > ORDER by uniquecol limit 50;
>
> > and next:
>
> > select * from mytable where somecondition AND uniquecol>?
> > ORDER by uniquecol limit 50 OFFSET 50;
>
> > where the ? is placeholder for last value returned by last query.
>
> Uh, you don't want the OFFSET there do you?

ooops! of course not. the uniquecol>? is meant to REPLACE
the OFFSET.

gnari

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Joel Fradkin 2005-04-08 17:08:44 Re: getting count for a specific querry
Previous Message Stef 2005-04-08 16:51:47 Numeric and CSV under 8.0.1 ?