Performance question: Union vs OR

"M. A. Sridhar" <[email protected]> Thu, 5 May 2005 12:02:17 -0700 (PDT)
Newsgroups gmane.comp.db.mckoi
Message-ID <[email protected]>
Hi Toby,

Can you throw some light on how the performance of the UNION operator
compares with using an OR? I am looking for a generic recommendation on the
circumstances under which use one or the other is preferable. Specifically,
we can say

select <select clause> from <table list> where <condition1>
union
select <select clause> from <table list> where <condition2>


or we can say

select <select clause> from <table list> where <condition1> or <condition2>


My questions:
- Is there any reason to prefer one form over the other? 
- Is there any impact on performance if either of these structures is used in
a subquery?


Thanks in advance.


M. A. Sridhar


		
Discover Yahoo! 
Stay in touch with email, IM, photo sharing and more. Check it out! 
http://discover.yahoo.com/stayintouch.html


---------------------------------------------------------------
Mckoi SQL Database mailing list  http://www.mckoi.com/database/
To unsubscribe, send a message to [email protected]