First, thanks, your suggestion worked.
To my surprise, it was enough to add limit 1 to the original query.
So:
select * from blocks,locations where locations.locid = blocks.locid AND ? =
blocks.startIpNum AND ? = blocks.endIpNum limit 1
takes about 1.398-005 seconds
and
select * from
Igor Tandetnik wrote:
Try searching for a value that doesn't fall into any block - you'll
likely find that the query takes a noticeable time to produce zero
records. Pick a large value that's greater than all startIpNum's.
Yes, you are right. That's why I'm going with the original