On 24 Dec 2011, at 14:15, thebigdog wrote:

> On 12/23/11 4:48 PM, Wade Preston Shearer wrote:
>> Am I correct in my understanding that the right side of an OR statement in an
>> MySQL query doesn't get evaluated unless the left side fails? I have a query
>> where the left-side case of an OR occurs often and produces an efficient
>> query and the right-side happens only occasionally and produces a slower,
>> less efficient query. If the query always checks both but only uses the left
>> if it is true, then I'd be better served to move it into two queries. If it
>> only checks the right-side condition if the left-side fails though, then
>> keeping it in one makes sense.
> 
> For queries like this you really need to check out the explain plan and see 
> what
> mysql is doing with your select statement. This is one of the best ways to
> determine when mysql will use indexes or not on your data.

To make sure I was clear, my OR is in the WHERE.


_______________________________________________

UPHPU mailing list
[email protected]
http://uphpu.org/mailman/listinfo/uphpu
IRC: #uphpu on irc.freenode.net

Reply via email to