Re: Pagination - 1 or 2 queries?

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: Pagination - 1 or 2 queries?
Дата
Msg-id 200309052103.h85L35Z18434@candle.pha.pa.us
обсуждение исходный текст
Ответ на Pagination - 1 or 2 queries?  (CSN <cool_screen_name90001@yahoo.com>)
Список pgsql-general
CSN wrote:
>
> Behind the scenes, is there much performance
> difference between:
>
> SELECT *
> FROM table_with_millions_of_rows
> ORDER BY col1;
>
> and:
>
> SELECT *
> FROM table_with_millions_of_rows
> ORDER BY col1
> LIMIT 100
> OFFSET 100000;

Yes, the optimizer knows it doesn't have to execute the entire query, so
the later can be faster, but that doesn't return the COUNT(*), as
requested.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

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

Предыдущее
От: Adam Kavan
Дата:
Сообщение: Re: Panic Index!!!!
Следующее
От: CSN
Дата:
Сообщение: Re: Pagination - 1 or 2 queries?