F
F
foobarsik2019-10-30 15:22:37
MySQL
foobarsik, 2019-10-30 15:22:37

How to optimize near by search?

There is a table Museums, which stores latitude and longitude (latitude / longitude).
The user on the site can select the search options: nearby / 5km / 10km.
When the user submits a search request, we take the user's latitude/longitude, iterate through each entry in the Museums table, and calculate the distance between the museum and the user to find museums that are nearby. How can such a search be optimized? Is it possible to somehow reduce the number of records from the Museums table that we will go through? By what principle can points be excluded from the search in advance?
Thank you.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question