OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
Best index for searching on lat / long data i.e. decimal vs. float

From: dan (dantappin.ca)
Date: Fri Apr 30 2010 - 16:54:07 CDT


I have a table with over 8 million rows of lat / long data all currently in
decimal(12,8) format (actually some in float(12,8)).

First question - should I have these all in decimal or float? I can't
think of any reason why I would actually do any math via mysql with this
data. I am just running queries and dumping the reults into a webapp.

Second question - my data is actual distinct rows with a north, east, south
and west lat / long for the boundary of a specific area. I want to search
based on a point lat / long (i.e. WHERE n > lat, s < lat, e > long, w <
long) to find the specific area that the point is located in.

I tried a simple index with my n,e,s & w but it still takes along time to
run such a query i.e. phpmyadmin times out. Any idea on the best structure
for such a query?

Thanks,

Dan T

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql