I'm writing an app that needs to allow a user to select elements that are within some radius of their location. There is no way to know how many locations there will be ultimately, but it might be tens of thousands. The user doing the search is one of the location nodes (and not just an arbitrary position submitted by their phone or whatnot)
I see answers like this: mysql lat lon calulation to show locations within radius but I'm concerned that this is a really serious undertaking given that the math involved will need to be calculated for every single "other" location.
The other approach I was considering is to have a relational table that identifies the distance between each location (that I'd populate every time a location was added), granted it will have a ton of rows to define every possible relationship, but then selecting against *that table will be super fast, especially if the distances are indexed.
Would love to get some advice from someone who's done this in mySQL and can warn/advise me for or against the best approach.