<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Mar 3, 2020 at 2:31 AM Sandro Santilli <<a href="mailto:strk@kbt.io">strk@kbt.io</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Tue, Mar 03, 2020 at 10:12:05AM +0000, <a href="mailto:paul.malm@lfv.se" target="_blank">paul.malm@lfv.se</a> wrote:<br>
> There was no difference between st_union() and st_unaryunion() when merging all adjacent polygons to  larger polygons.<br>
> The st_buffer() method is 3.5 times faster.<br>
<br>
The reason why ST_Buffer is faster is because it builds the topology<br>
of the geometry only once, while ST_Union builds it for each pair<br>
of geometries taken in exam. The ST_UnaryUnion version simply chooses<br>
which pair of geometries to union in order for the operation to be<br>
as effective as possible (drop more edges).<br>
<br>
There was a reason why we decided NOT to use GEOS Buffer internally<br>
for UnaryUnion, probably had to do with robustness, but I forgot the<br>
details. Maybe Martin can help here ?<br></blockquote><div><br></div><div>Unioning by buffer is sometimes faster than Unary Union (Cascaded), and sometimes not.  It all depends on the characteristics of the geometry being processed.  If there are a lot of overlapping geometries then Cascaded Union is faster.  </div><div><br></div><div>So both techniques are now available, and users can choose which works better for their data.</div><div><br></div><div>Paul, what does your dataset look like? </div></div></div>