Re: cursor MOVE vs OFFSET in SELECT

Поиск
Список
Период
Сортировка
От silly8888
Тема Re: cursor MOVE vs OFFSET in SELECT
Дата
Msg-id 3c8f9f940910260414o601f6e46o644ca5e6dd8fd075@mail.gmail.com
обсуждение исходный текст
Ответ на Re: cursor MOVE vs OFFSET in SELECT  (Grzegorz Jaśkiewicz <gryzman@gmail.com>)
Ответы Re: cursor MOVE vs OFFSET in SELECT  (Alvaro Herrera <alvherre@commandprompt.com>)
Список pgsql-general
2009/10/26 Grzegorz Jaśkiewicz <gryzman@gmail.com>:
>
>
> On Mon, Oct 26, 2009 at 10:30 AM, silly8888 <silly8888@gmail.com> wrote:
>>
>> Suppose that you have a query, say $sql_query, which is very
>> complicated and produces many rows. Which of the following is going to
>> be faser:
>>
>>    $sql_query OFFSET 3000 LIMIT 12;
>>
>> or
>>
>>    BEGIN;
>>    DECLARE cur1 CURSOR FOR $sql_query;
>>    MOVE 3000 IN cur1;
>>    FETCH 12 FROM cur1;
>>    COMMIT;
>>
>> Naturally, the former cannot be slower than the latter. So my question
>> essentially is whether the MOVE operation on a cursor is
>> (significantly) slower that a OFFSET on the SELECT.
>
>
> OFFSET/LIMIT. Afaik cursor always fetches everything.

Well, in my experiments they always perform the same. I suspect that
the way SELECT/OFFSET is implemented is not much different than
cursor/MOVE.

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

Предыдущее
От: Hans-Michael Stahl
Дата:
Сообщение: Allowed types in embedded SQL, ecpg
Следующее
От: Pavel Stehule
Дата:
Сообщение: Re: cursor MOVE vs OFFSET in SELECT