At 14:25 -0700 7/18/03, SAQIB wrote:
Paul,

Does this optimize the query? I thought both of the queries will have the
same relational algebra representation. Am I wrong?

They're logically equivalent, yes.


You appear to be under the impression that MySQL will *not* optimize
your original statement.  OR defeats the optimizer when it's used
to join tests on different keys, but your statement uses the same
key for all the comparisons.




Thanks.


Saqib Ali
---------
http://www.xml-dev.com

On Fri, 18 Jul 2003, Paul DuBois wrote:

 At 15:42 -0400 7/18/03, Chris Edwards wrote:
 >Hi
 >
 >This has probably come up before...
 >
 >Using version 3.23.54
 >
 >I have multiple OR logic in the where clause.
 >
 >where id = 1 or id = 2 or id = 3....
 >
 >The list is finite, at about 20 ids.
 >
 >I know i can say where != if the the OR count is more than half the list
 >items
 >
 >Is there any other way to provide optimization for this?

WHERE id IN(1,2,3,...)

NULL cannot be in the value list.


>Thanks. > >-- >Chris Edwards >Web Application Developer >Outer Banks Internet, Inc. >252-441-6698 >[EMAIL PROTECTED]
> >http://www.OuterBanksInternet.com


--
Paul DuBois, Senior Technical Writer
Madison, Wisconsin, USA
MySQL AB, www.mysql.com

Are you MySQL certified? http://www.mysql.com/certification/


-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to