id,summary,reporter,owner,description,type,status,priority,milestone,component,version,resolution,keywords,cc 3587,lwgeom_mindistance2d slows down topology loading,strk,strk,"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.",enhancement,closed,medium,PostGIS 3.5.0,topology,master,fixed,performance,dbaston