Re: getting count for a specific querry

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: getting count for a specific querry
Дата
Msg-id 15084.1112977923@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: getting count for a specific querry  (Ragnar Hafstað <gnari@simnet.is>)
Ответы Re: getting count for a specific querry  (Rod Taylor <pg@rbt.ca>)
Re: getting count for a specific querry  (Ragnar Hafstað <gnari@simnet.is>)
Список pgsql-sql
Ragnar Hafstað <gnari@simnet.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?  But otherwise, yeah,
this is a popular solution for paging through some rows.  Doesn't really
help with the problem of counting the total dataset though ...
        regards, tom lane


В списке pgsql-sql по дате отправления:

Предыдущее
От: Andrew Sullivan
Дата:
Сообщение: Re: getting count for a specific querry
Следующее
От: Stef
Дата:
Сообщение: Numeric and CSV under 8.0.1 ?