Joshua,

Joshua Spoerri wrote:
Which version is targetted for optimization of OR searching on two keys,
that is, "select * from sometable where f1 = 123 or f2 = 123",
as described in http://www.mysql.com/doc/en/Searching_on_two_keys.html
?

As described there MySQL can use only one index per table. It will work same way untill next major Optimizer update which is scheduled for 5.1


Meanwhile your query can be optimized with using of composite index over both columns:

mysql> explain select * from t where f1 = 10 or f2 = 10;
+-------+-------+---------------+------+---------+------+-------+--------------------------+
| table | type | possible_keys | key | key_len | ref | rows | Extra |
+-------+-------+---------------+------+---------+------+-------+--------------------------+
| t | index | f1 | f1 | 10 | NULL | 16384 | Using where; Using index |
+-------+-------+---------------+------+---------+------+-------+--------------------------+





Thanks



-- Are you MySQL certified? -> http://www.mysql.com/certification For technical support contracts, visit https://order.mysql.com/?ref=msal __ ___ ___ ____ __ / |/ /_ __/ __/ __ \/ / Mr. Alexander Keremidarski <[EMAIL PROTECTED]> / /|_/ / // /\ \/ /_/ / /__ MySQL AB, Full-Time Developer /_/ /_/\_, /___/\___\_\___/ Sofia, Bulgaria <___/ www.mysql.com




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



Reply via email to