List:General Discussion« Previous MessageNext Message »
From:Rik Wasmus Date:July 13 2012 7:51am
Subject:Re: why this query doesn't use index?
View as plain text  
> can you tell me why my this query doesn't use the index?
> mysql> explain select * from iploc where 1902800418 between start_ip
> and end_ip;

Hazarding a very quick guess: if this table is what I think it is (NON-
overlapping IP ranges + (geo)location), you might want to try:

SELECT *  FROM iploc 
WHERE start_ip < 1902800418
ORDER BY start_ip DESC

... at least, that is how we solved our geoip-performance problems. The NON-
overlappig part is crucial though.
Rik Wasmus
why this query doesn't use index?Doug13 Jul
  • Re: why this query doesn't use index?Rik Wasmus13 Jul
  • RE: why this query doesn't use index?Rick James16 Jul