On 2/6/07, Jochem van Dieten <[EMAIL PROTECTED]> wrote: > > > This query is not indexable so it needs to do the math on each and every > row. Prequalify the rows by drawing an imaginary box on the map from > b.lat + X to b.lat -X and b.lon + X to b.lon -X and finding only the > points in that box (the database can do that using an index). Then > perform your distance function only on the points in the box.
I did this to speed it up originally: SELECT B.zipcode FROM zipcodes B WHERE B.zipcode between '27002' and '28002' getDistance('27502',0.0,0.0,'',B.latitude,B.longitude) That caused it to only look at 1000 zip codes instead of 42000 zip codes. the lat/long adjustment would probably be more effective.. or perhaps at least, more accurate. Rick -- > I'm not certified, but I have been told that I'm certifiable... > Visit http://www.opensourcecf.com today! ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Upgrade to Adobe ColdFusion MX7 Experience Flex 2 & MX7 integration & create powerful cross-platform RIAs http:http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:268854 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4