Name

ST_MemUnion — Aggregate function which unions geometries in a memory-efficent but slower way

Synopsis

geometry ST_MemUnion(geometry set geomfield);

Descrição

An aggregate function that unions the input geometries, merging them to produce a result geometry with no overlaps. The output may be a single geometry, a MultiGeometry, or a Geometry Collection.

[Note]

Produces the same result as ST_Union, but uses less memory and more processor time. This aggregate function works by unioning the geometries incrementally, as opposed to the ST_Union aggregate which first accumulates an array and then unions the contents using a fast algorithm.

This function supports 3d and will not drop the z-index. However, the result is computed using XY only. The result Z values are copied, averaged or interpolated.

Exemplos

SELECT id,
       ST_MemUnion(geom) as singlegeom
FROM sometable f
GROUP BY id;

Veja também

ST_Union