[postgis-users] Finding all 'adjacent' points in a point set

Bruce Rindahl bruce.rindahl at gmail.com
Thu Jul 29 16:38:21 PDT 2021


The inner join did the trick.  I didn't know what a performance hit the CTE
was.  They just make it easier to read.
New Query:

select p1.id as src, p2.id as dest
from points p1
left join points p2 on st_dwithin(p1.geom,p2.geom,16*1.74)
where p1.id != p2.id
and p1.geom > p2.geom

order of magnitude faster on big tables
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20210729/2bad6952/attachment.html>


More information about the postgis-users mailing list