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

PostGIS trac at osgeo.org
Wed Jun 22 23:39:31 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
 Keywords:  performance  |
-------------------------+---------------------------
 Profiling an slow addition of a single point I found the CPU busy in
 computing the minimum distance between the newly added edge with 43520
 vertices and each of 2862 other edges intersecting it. Such operation
 takes a very long time, even multiple seconds for each single distance
 computation.

 Overall, the addition of a that _single_ line takes over 13 minutes.

 The same long timings can be seen using ST_Distance itself.
 Examples:

 {{{
 LOG:  duration: 1043.816 ms  statement: select a.id aid, b.id bid,
 st_npoints(a.wkb_geometry), st_npoints(b.wkb_geometry),
 st_distance(a.wkb_geometry, b.wkb_geometry) from contour_onet a,
 contour_onet b where a.id = 14408 and b.id = 9928;
   aid  | bid  | st_npoints | st_npoints |   st_distance
 -------+------+------------+------------+------------------
  14408 | 9928 |      43520 |        499 | 10568.8576870335
 (1 row)
 }}}

 {{{

 LOG:  duration: 4937.063 ms  statement: select a.id aid, b.id bid,
 st_npoints(a.wkb_geometry), st_npoints(b.wkb_geometry),
 st_distance(a.wkb_geometry, b.wkb_geometry) from contour_onet a,
 contour_onet b where a.id = 14408 and st_npoints(b.wkb_geometry) = 2247;
   aid  | bid  | st_npoints | st_npoints |   st_distance
 -------+------+------------+------------+------------------
  14408 | 9031 |      43520 |       2247 | 53917.1247457271
 (1 row)

 }}}

 This ticket is to find speed improvement opportunities.

--
Ticket URL: <https://trac.osgeo.org/postgis/ticket/3587>
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