[postgis-devel] More Cascade Union Adventures

Obe, Regina robe.dnd at cityofboston.gov
Wed Aug 13 10:53:42 PDT 2008


Thanks Webb,

Unfortunately I'm not sure how to figure out the array size as the aggregate is forming - since it doesn't seem I can get a count while its counting.

On the bright-side for most use cases, I don't think the penalty is that bad.  This was a test with I think 30,000 small polygons so in most cases rare. 

For example running my same  exercise on Massachusetts towns which has 351 records total - these are the results I get.  These are fairly large polygons but only 351 cycles   vs. the 30,000 small polys (30,000 cycles) I was testing earlier.  to me 52 secs vs. 56 secs is not that much to cry about.  Still way better than 585,482 ms of the default ST_Union.  

In this case JTS wins by quite a margin - and finishes in 16 secs.  I presume because there is no way to optimize for the fact that Geos just doesn't deal with large memory as well as JTS and also I am not taking into consideration the size of the polys.  So large polys JTS I'm guessing will win unless I take into consideration the area of each poly starting out which may add more overhead than it is worth.

--351 records
--52,983  ~ 52 secs
SELECT st_unitecascade_garray_sort(ARRAY(SELECT the_geom from towns))

--56,748 ms  ~ 56 secs 
SELECT ST_CascadeUnion(the_geom)
FROM towns

--585,482 ms. - 10 minutes
SELECT ST_Union(the_geom)
FROM towns

Open Jump JTS 1.9.0  - 16 secs

Thanks,
Regina


-----Original Message-----
From: postgis-devel-bounces at postgis.refractions.net on behalf of Webb Sprague
Sent: Wed 8/13/2008 12:59 PM
To: PostGIS Development Discussion
Subject: Re: [postgis-devel] More Cascade Union Adventures
 
, but evidentally the array accum calls give a major
>> penalty.

I can't add much to this discussion, but if you know how large your
array will be, there is now an operation to preallocate it (array_fill
or some such).  Should be google-able.

-W
_______________________________________________
postgis-devel mailing list
postgis-devel at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-devel






-----------------------------------------
The substance of this message, including any attachments, may be
confidential, legally privileged and/or exempt from disclosure
pursuant to Massachusetts law. It is intended
solely for the addressee. If you received this in error, please
contact the sender and delete the material from any computer.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-devel/attachments/20080813/e27dd333/attachment.html>


More information about the postgis-devel mailing list