faqts : Computers : Databases : MySQL : Installation and Setup : Problems

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

5 of 9 people (56%) answered Yes
Recently 5 of 9 people (56%) answered Yes

Entry

Why mysql doesn't use index in queries/DML that the where clause use 'or ' operator

Feb 16th, 2004 16:37
Tom Keyser, Hamba Allah,


Use IN instead of OR and MYSQL will use indexes

INCORRECT: this = '1' or this = '2'
CORRECT: this IN('1','2')