I work on the map and keep the locations in the database.
There are different locations of the map on the table. There are many locations within the table. Now different users come and click on different position on the map, so I have to select a query in the database to find each location. Is this correct? That means I run a query for every click.
In my opinion, specify a dimension(area), and whenever these dimensions are loaded, I select all the locations within those dimensions to avoid additional query select to database.
What is the best optimization way?
CodePudding user response:
What is a location on a map? Is it a single point? Or is it a region, such as a country, county, province, etc?
In the former case the problem is to "find the nearest" item on the map to the mouse click point. I cover that here
For the latter case, you need to turn each region into a polygon and enter it into a geographic object that is indexed with a SPATIAL
index.
It is beyond the scope of this forum to provide all the details for either of your cases. If you have trouble, come back with a more specific question, including the steps you have taken so far.