[postgis-devel] Lame attempt at cascade union in sql

Obe, Regina robe.dnd at cityofboston.gov
Fri Aug 8 00:10:22 PDT 2008


I think its C++.  But I still have a couple of tricks up my sleeve.  Anyrate eventually you are right it should be 
in GEOS.  Just don't have the c++ skills to port JTS to GEOS yet.  So this is just a stopgap measure.  As a side note- a completely pure
PostgreSQL solution would mean people don't need to upgrade to the latest GEOS to get the benefits.

-----Original Message-----
From: postgis-devel-bounces at postgis.refractions.net on behalf of Kevin Neufeld
Sent: Fri 8/8/2008 1:22 AM
To: PostGIS Development Discussion
Subject: Re: [postgis-devel] Lame attempt at cascade union in sql
 
Hmmm.  Still, I give you an applause for the speed an simplicity of your 
attempt.  Even my crazy looking GROUPBY/ORDERBY query that runs in 1min 
is still 3 times slower than Martin Davis's Java code in JTS.  Ideally, 
it would be best for someone to put the thing through GEOS so PostGIS 
can benefit from it as well.  Anyone feel like brushing up on their C?  :)

-- Kevin

Obe, Regina wrote:
>
> Curiosity got the better of me this time so I ran thru the full set 
> once and got this.  So still better, but I guess there is still room 
> for improvement and my cascading seems to not be growing linearly as 
> Kevin's is.
>
> --277,656 ms = 4.6276 minutes
> SELECT ST_CascadeUnion(the_geom)
> FROM (SELECT * FROM sample_poly) As foo;
>
> --69,953 ms = 1.16 minutes
> SELECT ST_Union(the_geom) AS the_geom
> FROM (
>    SELECT min(id) AS id, ST_Union(the_geom) AS the_geom
>    FROM (
>      SELECT min(id) AS id, ST_Union(the_geom) AS the_geom
>      FROM (
>        SELECT min(id) AS id, ST_Union(the_geom) AS the_geom
>        FROM (
>          SELECT min(id) AS id, ST_Union(the_geom) AS the_geom
>          FROM (SELECT * FROM sample_poly) As foo
>          GROUP BY round(id/10)
>          ORDER BY id) AS tmp1
>        GROUP BY round(id/100)
>        ORDER BY id) AS tmp2
>      GROUP BY round(id/1000)
>      ORDER BY id) AS tmp3
>    GROUP BY round(id/10000)
>    ORDER BY id) AS tmp4
> GROUP BY round(id/100000);
>
_______________________________________________
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/20080808/8e7cf733/attachment.html>


More information about the postgis-devel mailing list