[postgis-users] Slow spatial join with subquery and UNION
    Håvard Wahl Kongsgård 
    haavard.kongsgaard at gmail.com
       
    Sat Oct  9 10:33:44 PDT 2010
    
    
  
SELECT COUNT(DISTINCT SPATIAL_POINTS_1.id) from SPATIAL_POINTS_1 as
SPATIAL_POINTS_1 Inner join (Select geom from SPATIAL_POINTS_2 UNION SELECT
geom from SPATIAL_POINTS_3) as SPATIAL_POINTS_X on
ST_DWithin(SPATIAL_POINTS_1.the_geom, SPATIAL_POINTS_X.geom, 500)
This UNION subquery is very slow, there are indexes for each geom. If I
skip the UNION it's much faster.
Is there an alternative way to do this?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20101009/80188777/attachment.html>
    
    
More information about the postgis-users
mailing list