>>Ok, Thanks for the 2008 version
>
>If I recall from the metrix I obtained when comparing the two environments last year, there was as significant gain of performance when using the 2008 approach. When I ran in against 100000 records, the result was still instant. I really do not know how they do that internally, but they certainly did a good job.
I suppose ...
They hold some kind of index on the latitude and longitude
They then first select a subset (the rectangle form my previous message), so they don't have to calculate the distance for every record
And finally calculate the distance (aka radius) for each record in the subset
Finally, they may store the sin or cos along with the data (longitude and latitude) - so they don't have to recalculate those values every time
Gregory