I have a Microsoft SQL Server database with a location table. Each location has its own address, latitude and longitude coordinates.
In my application, the user can enter zipcode, and we will return the list of contacts by location. This is my approach. a) Using the zipcode DB database, I look through lat, lon for zipcode (this is the center point). b) I run a search like this
SELECT Position_ID, distance(pos_lon,pos_lat,zip_lon,zip_lat) dist FROM Positions ORDER BY dist
"distance" is a function that calculates the distance between two points.
The problem is that as my database grows, the launch time for these searches starts to grow.
Is there a better approach?
gonso source share