Re: Questions about LIMIT/OFFSET

Поиск
Список
Период
Сортировка
От Michael Glaesemann
Тема Re: Questions about LIMIT/OFFSET
Дата
Msg-id 87F0DF5C-7231-4D87-B40E-A352AF7A0505@seespotcode.net
обсуждение исходный текст
Ответ на Questions about LIMIT/OFFSET  (Josh Trutwin <josh@trutwins.homeip.net>)
Ответы Re: Questions about LIMIT/OFFSET  (Josh Trutwin <josh@trutwins.homeip.net>)
Список pgsql-general
On Oct 19, 2007, at 16:03 , Josh Trutwin wrote:

> SELECT * FROM table WHERE foo="bar" ORDER BY abc LIMIT x OFFSET y;

The server will have to generate at most OFFSET + LIMIT rows,
returning LIMIT rows or fewer.

> SELECT * FROM table WHERE foo="bar" ORDER BY abc;

This will return all of the rows available.

Unless you're going to be returning all of the rows where
foo="bar" (e.g., executing multiple LIMIT OFFSET queries) in one
request, I should think the first query would be more performant:
fewer rows for the server to process (in the final step at least) and
less data transmitted between the server and your application.

Michael Glaesemann
grzm seespotcode net



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

Предыдущее
От: "Joshua D. Drake"
Дата:
Сообщение: PostgreSQL Conference Fall 07 -- Registration Closed
Следующее
От: Ralph Smith
Дата:
Сообщение: Connection & logging Problems