many rows will match
and see if the index can be used. Until then, you have to use (a b OR
a b) if you want it to be optimized.
Matt
- Original Message -
From: [EMAIL PROTECTED]
Sent: Thursday, November 20, 2003 10:12 AM
Subject: strange difference between a != b and (a b OR a b
Description:
a simple select on a large table does not use an indexed column when the WHERE
clause uses a != b
The same query using as WHERE a b OR a b (which of course does the same)
*does* use an index.
How-To-Repeat:
mysql END_OF_FILE
create database unequalproblem;
use
Hi,
From the MySQL Manual:
MySQL normally uses the index that finds the least number of rows. An
index is used for columns that you compare with the following operators:
=, , =, , =, BETWEEN, and a LIKE with a non-wildcard prefix like
'something%'.
http://www.mysql.com/doc/en/MySQL_indexes.html