Reputation: 53196
What are the benefits of using a SPATIAL query rather than a simple MySQL query that utilised a bounding box?
For example, if I wanted to find all locations that fall within a certain polygon:
Something like this:
SELECT * FROM geoplaces
WHERE geolat BETWEEN ? AND ?
AND geolng BETWEEN ? AND ?
As I understand, the only real benefit is that spatial will also factor in the earth's curvature?
Which method is fastest also?
Upvotes: 1
Views: 2194
Reputation: 2205
Advantages:
Disadvantages:
If your database is large and you need searches like the one in your example to be fast, you should definitely go with SPATIAL indexes.
Upvotes: 4