[postgis-users] speeding up KNN query
Ilia
ilia at lobsanov.com
Fri Jul 19 13:46:56 PDT 2013
I have the following query which I'd like to speed up from the current
200ms. I do need the distance in meters which is why I'm using
ST_Distance_Sphere. Your help is very much appreciated.
SELECT "places".* FROM (
SELECT
*,
ST_Distance_Sphere(geom, 'SRID=4326;POINT(-79.3937393 43.6526704)') as distance
FROM places
ORDER by geom <#> 'SRID=4326;POINT(-79.3937393 43.6526704)' LIMIT 50
) AS places
WHERE "places"."place_category_id" = 10 ORDER BY distance ASC LIMIT 5
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20130719/ce30d981/attachment.html>
More information about the postgis-users
mailing list