Re: LIMIT: does it cause the query to find all matching sets first?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: LIMIT: does it cause the query to find all matching sets first?
Дата
Msg-id 21393.1033398467@sss.pgh.pa.us
обсуждение исходный текст
Ответ на LIMIT: does it cause the query to find all matching sets first?  (Jean-Christian Imbeault <jc@mega-bucks.co.jp>)
Список pgsql-general
Jean-Christian Imbeault <jc@mega-bucks.co.jp> writes:
> Does using LIMIT cause query execution to stop as soon as the LIMIT
> number of matches have been found, or are *all* the matching rows found
> first and then the first LIMIT number are returned?

The current implementation actually stops after fetching, or at least
trying to fetch, one more row than the LIMIT+OFFSET sum.  The extra row
is for internal convenience (keeps the direction-reversal logic in
nodeLimit.c simple).  Some people have complained about that, but no
one's gotten annoyed enough to rewrite nodeLimit to avoid it.

            regards, tom lane

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

Предыдущее
От: Bruno Wolff III
Дата:
Сообщение: Re: LIMIT: does it cause the query to find all matching sets first?
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: LIMIT: does it cause the query to find all matching sets