Re: Synchronized scans - Mailing list pgsql-patches

From Heikki Linnakangas
Subject Re: Synchronized scans
Date
Msg-id 46692663.9020907@enterprisedb.com
Whole thread Raw
In response to Re: Synchronized scans  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-patches
Tom Lane wrote:
> Heikki Linnakangas <heikki@enterprisedb.com> writes:
>> I fixed a little off-by-one in "backward scan, not inited" branch, but I
>> was unable to test it. It seems that code is actually never used because
>> that case is optimized to a rewind in the executor. I marked those
>> seemingly unreachable places in the code with a comment.
>
> Actually it's not equivalent to a rewind, it's more like the startup
> condition for an Index Scan Backward: start at the far end of the
> relation and go backwards.  I suspect that the whole thing may be
> unreachable code because the planner knows that seqscans are unordered
> and backward-scan is only of interest for an ordered scan.

Right. I was looking at the case where you open a cursor and start
immediately scanning backwards. That's optimized to a rewind.

--
   Heikki Linnakangas
   EnterpriseDB   http://www.enterprisedb.com

pgsql-patches by date:

Previous
From: Tom Lane
Date:
Subject: Re: Synchronized scans
Next
From: Heikki Linnakangas
Date:
Subject: Re: Synchronized scans