I am trying to find an efficient way to do proximity queries, ie to return POINTs which are within a radius from a central POINT.
I understand that PostGIS's ST_DWithin method is a good way to do this in PostgreSQL and that it uses the INDEX.
I am currently using ST_Distance_Sphere(g1, g2 [, radius]) which returns the minimum spherical distance between Point on a sphere, in meters.
SELECT placeNames FROM myPlaces
WHERE ST_Distance_Sphere(placeLocation, POINT(28.861105, 77.337)) < 10000
I'm using the WHERE clause to filter the rows. Is the query using the index? If no, is there a better approach to implement the same.
I'm using MySQL 5.7.26 and 8.0.16, both running the default InnoDB database engine.
解决方案
At this point in MySQL, there seems to be no 'more efficient' alternative to ST_Distance_Sphere or any other which uses a spatial index.