Re: updated SORT/LIMIT patch - Mailing list pgsql-patches

From Tom Lane
Subject Re: updated SORT/LIMIT patch
Date
Msg-id 12213.1179430948@sss.pgh.pa.us
Whole thread Raw
In response to Re: updated SORT/LIMIT patch  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-patches
I wrote:
> I am thinking that a cleaner fix is probably to make ExecRescanLimit do
> the recompute_limits() bit immediately, so that the new limits are
> available to the Sort node when it gets the rescan call.  The comment
> about timing of recompute_limits() is referring to the fact that
> parameters aren't set at ExecInitLimit() time, but I believe they are
> (and should be) available at Rescan time.  Will give it a try anyway.

Indeed, this way seems to work fine --- and in fact that's what we'd
have to do anyway if we were to merge the parameter-passing into
chgParam signaling.  I didn't try to do that, just committed a patch
to fix the immediate problem.

BTW, as for your earlier worries about useless re-sorts when
randomAccess wasn't requested: the design intention is that randomAccess
*will* be requested in any situation where repeat scans are likely.  So
there's no point in uglifying the tuplesort API to make an unexpected
rescan fast.  If you are seeing cases where a useless re-sort actually
happens, we might have some bugs in the EXEC_FLAG_REWIND signaling.

            regards, tom lane

pgsql-patches by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: Diagnostic functions
Next
From: Tom Lane
Date:
Subject: Re: UTF8MatchText