Hi Thomas, all!

Thomas van Gulick wrote:
[[...]]

Test:
EXPLAIN SELECT * FROM t WHERE T="x";
Result: key T used

EXPLAIN SELECT * FROM t WHERE T!="x";
Result: key T _unused_

To be expected:
An "unequal" condition will evaluate to "true" for a very large proportion of the index entries, so the selectivity will be too low.

The mere existence of an index does not imply that using it to access the data is a good decision, doing this only pays off if the extra accesses (to the index) are less work than is saved by not accessing those data rows which are not returned by the index.

You wouldn't use a catalogue in manual search if a sequential scan would return 1 out of 4 (or more) items, right ? The same holds here.


Joerg

--
Joerg Bruehe, Senior Production Engineer
MySQL AB, www.mysql.com
Office:  (+49 30) 417 01 487     VoIP: [EMAIL PROTECTED]

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

Reply via email to