Hi, Bill Easton wrote: > I think that MySQL is doing what would be expected, namely an index scan > which reads entire index on IP and selects distinct values of IP.
What I expect it to do is to give me all the distinct values in that row. It should be able to notice that there are only a few distinct values in there, and a "select distinct" over an indexed column doesn`t need to do a full scan. An open-coded loop > val = db.Do("select min(IP) from test") > while (val) { > process(val) > val = db.Do("select min(IP) from test where IP > '$val'") > } runs almost instantly. MySQL should be able to do that optimization, it's rather obvious (ten million rows, and IP has less than 100 different values). -- Matthias Urlichs | {M:U} IT Design @ m-u-it.de | [EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]