I added the multicolumn, and still have the same problem :

mysql> explain SELECT org from ip2org where ip_start<=1094799892 and
ip_end>=1094799892;
+--------+------+---------------+------+---------+------+---------+---------
---+
| table  | type | possible_keys | key  | key_len | ref  | rows    | Extra
|
+--------+------+---------------+------+---------+------+---------+---------
---+
| ip2org | ALL  | ip_start      | NULL |    NULL | NULL | 2943079 | where
used |
+--------+------+---------------+------+---------+------+---------+---------
---+
-----------------------



mysql can only use one index from a particular table in any one
query.  So if you want to do a query that uses both ip_start and
ip_end, you would need to create a multicolumn index on ip_start,ip_end
or vice versa.

What you have is one index on ip_start, and another on ip_end.  So
it can use one of the indexes, but then it has to scan each row that
matches.



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

Reply via email to