Re: How to create a cursor that is independent of transactions and doesn't calculated when created ?

Поиск
Список
Период
Сортировка
От David Johnston
Тема Re: How to create a cursor that is independent of transactions and doesn't calculated when created ?
Дата
Msg-id 1372985031331-5762623.post@n5.nabble.com
обсуждение исходный текст
Ответ на Re: How to create a cursor that is independent of transactions and doesn't calculated when created ?  (boraldomaster <boraldomaster@gmail.com>)
Список pgsql-general
boraldomaster wrote
>
> David Johnston wrote
>> Your original examples only create the cursor and do not actually use it.
>> You should be comparing how long it takes both examples to fetch the
>> first 10 pages of records to get a meaningful comparison.  It won't
>> matter if the DECLARE only takes 3ms in the non-hold case if retrieving
>> the first page of records take 2s.
> Certainly -
*
> close all;
> begin;
> declare mycursor cursor for select * from z order by name;
> fetch 10 from mycursor;
> commit;
*
>  - takes 3 ms all.
> Each
*
> fetch 10 from mycursor
*
>  takes 1-2 ms.
> So this is perfectly optimized in transaction. And I wonder why isn't it
> optimized for a whole session.

I am sorry I cannot answer this kind of "why was it implemented in
such-and-such way" question.  Maybe someone from the core programming team
will chime in.

David J.







--
View this message in context:
http://postgresql.1045698.n5.nabble.com/How-to-create-a-cursor-that-is-independent-of-transactions-and-doesn-t-calculated-when-created-tp5762401p5762623.html
Sent from the PostgreSQL - general mailing list archive at Nabble.com.


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

Предыдущее
От: David Carpio
Дата:
Сообщение: decrease my query duration
Следующее
От: bricklen
Дата:
Сообщение: Re: decrease my query duration