[postgis-tickets] [PostGIS] #3587: lwgeom_mindistance2d slows down topology loading

PostGIS trac at osgeo.org
Thu Jun 23 00:36:44 PDT 2016


#3587: lwgeom_mindistance2d slows down topology loading
-----------------------+---------------------------
  Reporter:  strk      |      Owner:  strk
      Type:  defect    |     Status:  new
  Priority:  medium    |  Milestone:  PostGIS 2.2.3
 Component:  topology  |    Version:  2.2.x
Resolution:            |   Keywords:  performance
-----------------------+---------------------------

Comment (by nicklas):

 Yes, this is good.

 I think Paul have the solution, we just have to encourage him a little.

 Some background:
 My first contribution to PostGIS was about this, added in 1.5.

 But the result of that only helps when bounding boxes is not overlapping.
 What I did is described in:
 https://trac.osgeo.org/postgis/wiki/NewDistCalcGeom2Geom

 This gives a good boost, when bbox isn't overlapping.

 I added 3 geometries as example in attachement.

 I copied and moved one of them so the bounding boxes overlap.

 So those 2 queries is using the same geometries, but the first query with
 overlapping bounding boxes:

 {{{
 select st_npoints(a.geom), st_npoints(b.geom), st_distance(a.geom, b.geom)
 from
 (select geom from t where gid = 1) a,
 (select geom from t where gid = 2) b
 }}}

 {{{
 st_npoints | st_npoints |   st_distance
 ------------+------------+-----------------
       55773 |      31248 | 1791.9837591391
 (1 row)


 Time: 73239.353 ms
 }}}
 {{{
 select st_npoints(a.geom), st_npoints(b.geom), st_distance(a.geom, b.geom)
 from
 (select geom from t where gid = 1) a,
 (select geom from t where gid = 3) b
 }}}


 {{{

  st_npoints | st_npoints |   st_distance
 ------------+------------+------------------
       55773 |      31248 | 194387.282408659
 (1 row)

 Time: 709.125 ms
 }}}
 So this is good, but useless in many situations. But Paul have some tree-
 structure that will do the thing.

 Do it Paul, just do it :-)

--
Ticket URL: <https://trac.osgeo.org/postgis/ticket/3587#comment:3>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.


More information about the postgis-tickets mailing list