On Thu, 21 Aug 2003 16:42:20 -0400, Tom Lane <tgl@sss.pgh.pa.us>
wrote:
>The point is that given
> WHERE a = 1 OR b = 1
>you could create a plan that first indexscans on a, then indexscans on
>b --- but you mustn't return any tuples in the second scan that you
>already returned in the first. IndexNext solves this by evaluating the
>prior-scan index conditions to see if they are true.
WHERE a = 1 OR b = 2
andWHERE a = 1 OR a = 2
are totally different things. In the latter case you don't have to
check prior conditions because the conditions are mutually exclusive.
Is this reasonably easy to find out at plan creation time?
Yes, I changed your example to make my point clear, becauseWHERE a = 1 OR a = 1
has its own set of problems.
ServusManfred