use UNION instead of OR
I see the advice of using UNION in place of OR in many tuning articles but I can't find any Metalink articles that explain what is going on.
I still find in 10g "UNION" / "UNION ALL" will often out perform: "OR".
Why? Where is this documented?
Thanks!
example:
select * from foo where id in(n) OR id in (m);
-vs-
select * from foo where id in (n)
UNION
select * from foo where id in (m);
where n & m are in the form
select id from bar where ....
col id in foo is indexed and NOT NULL the index can be unique or nonunique
UNION can be in the form UNION or UNION ALL
I already understand that this works, I see this in many tuning books (google: "use union instead of or")
my question is WHY it works, WHERE is it documented in Oracle.
thanks