HELP!!! Need Database Expert, Please
Wow this place has changed!
Anyway, down to business ...
I have a problem. I have developed an online script that will allow its users to perform a database search for the number of records within a radius of a given zipcode.
The results of this query must match (close enough) with the results of the same query using AccuZip software.
So far it functions exactly as it should, the way the calculations are performed, However it is too slow.
Currently taking over 9 seconds ...
Can someone take a look at the query, and make suggestions on how to improve upon it, to speed it up ...
-------------------
SELECT COUNT(*) as COUNT FROM (
SELECT unique_id, lat,lon,(((acos(sin((34.099800*pi()/180)) * sin((`lat`*pi()/180))+cos((34.099800*pi()/180)) * cos((`lat`*pi()/180)) * cos(((-118.412003- `Lon`)*pi()/180))))*180/pi())*60*1.1515) as distance FROM records)
as result WHERE distance <= 150;
-----------------------------
Any takers? the 150 is 150 mile radius, and the starting point is 34.099800,-118.412003
-
javrsmith -
Thanks
{{ DiscussionBoard.errors[10620952].message }} -
-
David Beroff -
Thanks
SignaturePut MY voice on YOUR video: AwesomeAmericanAudio.com{{ DiscussionBoard.errors[10622169].message }} -