Hi,
I found that mysql doesn't used indexes if there is a <> in the where 
statement...
for example
mysql> explain select * from testtable where id <> 5;
+---------+------+---------------+------+---------+------+-------+------------+
| table   | type | possible_keys | key  | key_len | ref  | rows  | Extra      |
+---------+------+---------------+------+---------+------+-------+------------+
| testtable | ALL  | NULL          | NULL |    NULL | NULL | 13505 | where 
used |
+---------+------+---------------+------+---------+------+-------+------------+
1 row in set (0.00 sec)

please note that id is the primary key for the table...

any ideas on how to optimize this type of queries ?

Nat


--------------------------------------------------
Natalino Picone - [EMAIL PROTECTED]
--------------------------------------------------
It's a horrible thing to be on top of the world and then to lose it and try 
to get it back.
It's a whole lot harder the second time.
--------------------------------------------------



---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to