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

Поиск
Список
Период
Сортировка
От Bruno Wolff III
Тема Re: LIMIT: does it cause the query to find all matching sets first?
Дата
Msg-id 20020930151257.GA15432@wolff.to
обсуждение исходный текст
Ответ на LIMIT: does it cause the query to find all matching sets first?  (Jean-Christian Imbeault <jc@mega-bucks.co.jp>)
Список pgsql-general
On Mon, Sep 30, 2002 at 23:15:43 +0900,
  Jean-Christian Imbeault <jc@mega-bucks.co.jp> wrote:
> 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?

Limit can speed things up. Even with an ordered by clause it can speed things
up (if there is an appropiate index). This can be used to quickly find
the maximum or minimum value of an indexed column.

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

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