Your table bb is not indexed in a way that helps this query. Creating an

index on min_number may help somewhat.

If your intervals DON'T overlap each other, there's probably a much
better
algorithm for you to use than an SQL join. (e.g., select each number
from aa
in sequence, form a query for each one to determine the range into which
it fits:
"Select range_type from bb where some_number >= min_number order by
min_number limit 1" or something like that.
You might be able to complete these 50,000 queries faster than 7
minutes.)

Cheers,

Kent


---------------------------------------------------------------------
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