Re: scrollable cursor support without MOVE statement

Lists: pgsql-patches
From: "Pavel Stehule" <pavel(dot)stehule(at)hotmail(dot)com>
To: pgsql-patches(at)postgresql(dot)org
Cc: magnus(at)hagander(dot)net, bruce(at)momjian(dot)us
Subject: scrollable cursor support without MOVE statement
Date: 2007-03-28 15:42:02
Message-ID: BAY114-F193E0B9533879797313B3EF96D0@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

>
>This is the most recent email I have on this. Was the scrollable patch
>applied? If not, would you resubmit?
>

I resubmit scrollable cursor patch

Regards
Pavel Stehule

_________________________________________________________________
Emotikony a pozadi programu MSN Messenger ozivi vasi konverzaci.
http://messenger.msn.cz/

Attachment Content-Type Size
scrollable_cursors.diff text/x-patch 44.7 KB

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Pavel Stehule <pavel(dot)stehule(at)hotmail(dot)com>
Cc: pgsql-patches(at)postgresql(dot)org, magnus(at)hagander(dot)net
Subject: Re: scrollable cursor support without MOVE statement
Date: 2007-03-28 21:04:31
Message-ID: 200703282104.l2SL4VL16838@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches


Your patch has been added to the PostgreSQL unapplied patches list at:

http://momjian.postgresql.org/cgi-bin/pgpatches

It will be applied as soon as one of the PostgreSQL committers reviews
and approves it.

---------------------------------------------------------------------------

Pavel Stehule wrote:
> >
> >This is the most recent email I have on this. Was the scrollable patch
> >applied? If not, would you resubmit?
> >
>
> I resubmit scrollable cursor patch
>
> Regards
> Pavel Stehule
>
> _________________________________________________________________
> Emotikony a pozadi programu MSN Messenger ozivi vasi konverzaci.
> http://messenger.msn.cz/

[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: explain analyze is your friend

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +


From: "Simon Riggs" <simon(at)2ndquadrant(dot)com>
To: "Pavel Stehule" <pavel(dot)stehule(at)hotmail(dot)com>
Cc: <pgsql-patches(at)postgresql(dot)org>, <magnus(at)hagander(dot)net>, <bruce(at)momjian(dot)us>
Subject: Re: scrollable cursor support without MOVE statement
Date: 2007-04-16 21:01:14
Message-ID: 1176757274.3635.364.camel@silverbirch.site
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

On Wed, 2007-03-28 at 17:42 +0200, Pavel Stehule wrote:
> >
> >This is the most recent email I have on this. Was the scrollable patch
> >applied? If not, would you resubmit?
> >
>
> I resubmit scrollable cursor patch

I notice your patch has been accepted, though admit I hadn't noticed it
previously.

Can I ask a question relating to the patch?
How is the scrollability determined?

Scrollable cursors and sorts don't mix very well in terms of
performance, as you may know. Previously, since NOSCROLL was the only
option, this wasn't a problem. Now that we have scrollable cursors, it
is an issue, since according to the doc change the scrollability default
is neither scroll nor noscroll.

I'm concerned that many PL/pgSQL routines will now run slower because
they may now be considered scrollable when they previously were not. How
is the scrollability determined? Do we look at the kids of FETCH being
used to determine whether we need scrolling? (which would be great) Or
will we have to manually change all existing PL/pgSQL code so that it is
definitely NOSCROLL? (which would be unacceptable). Or?

--
Simon Riggs
EnterpriseDB http://www.enterprisedb.com


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Simon Riggs" <simon(at)2ndquadrant(dot)com>
Cc: "Pavel Stehule" <pavel(dot)stehule(at)hotmail(dot)com>, pgsql-patches(at)postgresql(dot)org, magnus(at)hagander(dot)net, bruce(at)momjian(dot)us
Subject: Re: scrollable cursor support without MOVE statement
Date: 2007-04-16 22:18:38
Message-ID: 11371.1176761918@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

"Simon Riggs" <simon(at)2ndquadrant(dot)com> writes:
> I'm concerned that many PL/pgSQL routines will now run slower because
> they may now be considered scrollable when they previously were not.

There is no change in the default behavior.

regards, tom lane


From: "Simon Riggs" <simon(at)2ndquadrant(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Pavel Stehule" <pavel(dot)stehule(at)hotmail(dot)com>, <pgsql-patches(at)postgresql(dot)org>, <magnus(at)hagander(dot)net>, <bruce(at)momjian(dot)us>
Subject: Re: scrollable cursor support without MOVE statement
Date: 2007-04-16 22:42:21
Message-ID: 1176763341.3635.384.camel@silverbirch.site
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

On Mon, 2007-04-16 at 18:18 -0400, Tom Lane wrote:
> "Simon Riggs" <simon(at)2ndquadrant(dot)com> writes:
> > I'm concerned that many PL/pgSQL routines will now run slower because
> > they may now be considered scrollable when they previously were not.
>
> There is no change in the default behavior.

Previously:
- PL/pgSQL cursors were non-scrollable
- DECLARE CURSOR cursors were not non-scrollable by default

The new docs say it is "query dependent", whereas previously the default
was non-scrollable. That sounds like a change in the default behaviour,
so I'm trying to dig a little deeper.

Are you saying that if I don't say anything at all then a cursor will be
non-scrollable?

--
Simon Riggs
EnterpriseDB http://www.enterprisedb.com


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Simon Riggs" <simon(at)2ndquadrant(dot)com>
Cc: "Pavel Stehule" <pavel(dot)stehule(at)hotmail(dot)com>, pgsql-patches(at)postgresql(dot)org, magnus(at)hagander(dot)net, bruce(at)momjian(dot)us
Subject: Re: scrollable cursor support without MOVE statement
Date: 2007-04-16 22:56:58
Message-ID: 11760.1176764218@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

"Simon Riggs" <simon(at)2ndquadrant(dot)com> writes:
> On Mon, 2007-04-16 at 18:18 -0400, Tom Lane wrote:
>> There is no change in the default behavior.

> Previously:
> - PL/pgSQL cursors were non-scrollable
> - DECLARE CURSOR cursors were not non-scrollable by default

No, they weren't "non-scrollable", they were the same as the default
case for DECLARE CURSOR. You just couldn't tell (from within plpgsql
anyway) for lack of any form of FETCH that would exercise backward
motion.

The actual code behavior is, and has been for a long time,

SCROLL -> if plan doesn't handle backwards scan, stick a Materialize
node atop it so it can.

NO SCROLL -> do nothing to plan. In pquery.c, throw error if an attempt
is made to fetch backwards.

default -> if plan doesn't handle backwards scan, use NO SCROLL behavior.
If it does, silently allow scrolling.

The previous state of affairs was that plpgsql had no way to specify
SCROLL or NO SCROLL and so always got the default behavior. Now it
does, but the default behavior is still the same.

regards, tom lane


From: "Pavel Stehule" <pavel(dot)stehule(at)hotmail(dot)com>
To: simon(at)2ndquadrant(dot)com
Cc: pgsql-patches(at)postgresql(dot)org, magnus(at)hagander(dot)net, bruce(at)momjian(dot)us
Subject: Re: scrollable cursor support without MOVE statement
Date: 2007-04-18 04:37:55
Message-ID: BAY114-F15A6EC6A2AADC37EDF3E25F9500@phx.gbl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches


>On Wed, 2007-03-28 at 17:42 +0200, Pavel Stehule wrote:
> > >
> > >This is the most recent email I have on this. Was the scrollable patch
> > >applied? If not, would you resubmit?
> > >
> >
> > I resubmit scrollable cursor patch
>
>I notice your patch has been accepted, though admit I hadn't noticed it
>previously.

I resubmited this patch because Bruce removed it from queue instead of GUC
protection patch

>
>Can I ask a question relating to the patch?
>How is the scrollability determined?
>
>Scrollable cursors and sorts don't mix very well in terms of
>performance, as you may know. Previously, since NOSCROLL was the only
>option, this wasn't a problem. Now that we have scrollable cursors, it
>is an issue, since according to the doc change the scrollability default
>is neither scroll nor noscroll.

default is noscroll

>
>I'm concerned that many PL/pgSQL routines will now run slower because
>they may now be considered scrollable when they previously were not. How
>is the scrollability determined? Do we look at the kids of FETCH being
>used to determine whether we need scrolling? (which would be great) Or
>will we have to manually change all existing PL/pgSQL code so that it is
>definitely NOSCROLL? (which would be unacceptable). Or?
>

default is without changes on functionality.

Regards
Pavel Stehule

_________________________________________________________________
Emotikony a pozadi programu MSN Messenger ozivi vasi konverzaci.
http://messenger.msn.cz/


From: "Simon Riggs" <simon(at)2ndquadrant(dot)com>
To: "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "Pavel Stehule" <pavel(dot)stehule(at)hotmail(dot)com>, <pgsql-patches(at)postgresql(dot)org>, <magnus(at)hagander(dot)net>, <bruce(at)momjian(dot)us>
Subject: Re: scrollable cursor support without MOVE statement
Date: 2007-04-18 22:13:39
Message-ID: 1176934420.3650.109.camel@silverbirch.site
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

On Mon, 2007-04-16 at 18:56 -0400, Tom Lane wrote:
> the default behavior is still the same

Just had time to check this. You're right, my mistake.

--
Simon Riggs
EnterpriseDB http://www.enterprisedb.com