[geos-devel] [GEOS] #997: ST_Union performance degradation from GEOS 3.6.x -> 3.7.x

GEOS geos-trac at osgeo.org
Thu Oct 10 09:15:41 PDT 2019

#997: ST_Union performance degradation from GEOS 3.6.x -> 3.7.x
 Reporter:  greenlaw     |       Owner:  geos-devel@…
     Type:  defect       |      Status:  new
 Priority:  major        |   Milestone:
Component:  Default      |     Version:  3.7.0
 Severity:  Significant  |  Resolution:
 Keywords:  union        |

Comment (by greenlaw):

 Sorry, was not clear about the query grouping. It's been a few years since
 I wrote this code so it's not exactly fresh in my mind, but I believe what
 I was trying to accomplish is merging adjacent polygons that have matching
 attributes. I'm applying the buffer first in order to ensure close-by
 polygons are union'd even if they don't touch.

 Looks like I was compiling with `-O2 -Os`, so I've changed that to `-O3`
 and ran your query (using 3.7.3 for this test), which ran in ~168 sec
 (guess my docker instance inside a VM on my laptop is not quite as fast as
 your machine :). So yes looks like a normal Union works in reasonable

 explain analyze select st_npoints(st_union(st_buffer(wkb_geometry,100)))
 from nws_haz_hang_201910 ;
                                                       QUERY PLAN
  Aggregate  (cost=10.15..10.19 rows=1 width=32) (actual
 time=168404.120..168404.121 rows=1 loops=1)
    ->  Seq Scan on nws_haz_hang_201910  (cost=0.00..10.10 rows=10
 width=32) (actual time=0.006..0.041 rows=21 loops=1)
  Planning time: 0.055 ms
  Execution time: 168407.313 ms

Ticket URL: <https://trac.osgeo.org/geos/ticket/997#comment:4>
GEOS <http://trac.osgeo.org/geos>
GEOS (Geometry Engine - Open Source) is a C++ port of the Java Topology Suite (JTS).

More information about the geos-devel mailing list