Well I want your opinions about this case:

I need a database that will have... two or three tables at most, one of them will have points (latitude, longitude) and some other info.

It's really simple what I need: Get the points within a given radius.

I'm not asking how to do it (but any advice is more than welcome, specially if it's about good practices), I want to know if making use of the MySQL's spatial support would help. Since what I need is fairly easy to get with just one query, what I expect by using Spatial support is to increase performance.

So, are the spatial indexes going to help noticeably? I don't think the table will store that many points. I'd say no more than 200.

有帮助吗?

解决方案

If it's really only 200 points, I recommend you do without: This makes it much easier to write portable SQL (which I consider an important thing).

Write your SQL so, that first longitued and latitude are checked against the precalculated mins and maxes (giving you a rectangle), then check for the radius. This way, you will only need to calculate the radius without finally selecting the point for 1/pi of the result set.

I personally consider this an acceptable tradeof against writing SQL, that could if must be executed against SQlite or whatever.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top