Re: Synchronized scans - Mailing list pgsql-patches

From Tom Lane
Subject Re: Synchronized scans
Date
Msg-id 27673.1181319722@sss.pgh.pa.us
Whole thread Raw
In response to Re: Synchronized scans  (Heikki Linnakangas <heikki@enterprisedb.com>)
Responses Re: Synchronized scans  (Jeff Davis <pgsql@j-davis.com>)
List pgsql-patches
Heikki Linnakangas <heikki@enterprisedb.com> writes:
> Tom Lane wrote:
>> Jeff Davis <pgsql@j-davis.com> writes:
>>> Just to be sure: a backwards-started scan is currently unreachable code,
>>> correct?
>>
>> [ yawn... ]  I think so, but I wouldn't swear to it right at the moment.
>> In any case it doesn't seem like a path that we need to optimize.

> Agreed, let's just disable the reporting when moving backwards.

Now that I'm awake, it is reachable code, per this comment:

 * Note: when we fall off the end of the scan in either direction, we
 * reset rs_inited.  This means that a further request with the same
 * scan direction will restart the scan, which is a bit odd, but a
 * request with the opposite scan direction will start a fresh scan
 * in the proper direction.  The latter is required behavior for cursors,
 * while the former case is generally undefined behavior in Postgres
 * so we don't care too much.

That is, if you run a cursor to the end and then back up, you'll go
through the init-in-the-backwards-direction code.

But we're agreed that we don't want to report when moving backwards,
so this is just an interesting note...

            regards, tom lane

pgsql-patches by date:

Previous
From: Tom Lane
Date:
Subject: Re: Synchronized scans
Next
From: Jeff Davis
Date:
Subject: Re: Synchronized scans