Google Maps data in database
Posted on 2012-09-04
I am creating a data backend for a Google Maps development.
I know how to perform the PHP request, teh SQL statement and the display mechanism.
I am using the location script for my SQL Statement:
SELECT id, ( 3959 * acos( cos( radians(37) ) * cos( radians( lat ) ) * cos( radians( lng ) - radians(-122) ) + sin( radians(37) ) * sin( radians( lat ) ) ) ) AS distance
FROM markers HAVING distance < 25 ORDER BY distance LIMIT 0 , 20;
I have a table that has the following:
Name, Description, Address1, City, State, Zip, lat, long, etc...
my question is indexing the datatable for fast response.
What I don't normally see is how the datatable is formed.
if I have 100,000 records, should I place indexes?
and if so? where?
They will be searching distance from zip? search by zip? city,state? and single address.
they may filter from there.
Any ideas would be great. I got the code, I just want to optimize the backend.