
>Another idea would be to do actual UNION queries:
>
>	SELECT * FROM tab
>	WHERE (x=3 and y=4)
>	UNION
>	SELECT * FROM tab
>	WHERE (x=3 and y=5)
>	UNION
>	SELECT * FROM tab
>	WHERE (x=3 and y=6) ...
>
>This would work well for tables with indexes, but for a sequential scan,
>you are doing a sequential scan for each UNION.

The most important Application for this syntax will be M$ Access
because it uses this syntax to display x rows from a table in a particular
sort order. In this case x and y will be the primary key and therefore have a
unique index. So I think this special case should work good.

The strategy could be something like:
iff x, y is a unique index
	do the union access path
else
	do something else
done

I think hand written SQL can always be rewritten if it is not fast enough
using this syntax.

Andreas


Mon, 31 Aug 1998 12:22:05 +0200
Andreas Zeugswetter <andreas.zeugswetter@telecom.at>
AW: [INTERFACES] Re: [HACKERS] changes in 6.4