[geos-devel] fastunion aggregate

strk strk at keybit.net
Mon Oct 27 15:18:15 EST 2003


Changes committed.
Here is SQL code to enable/disable "fastunion"

--8<------------------------------------------------------------------

DROP AGGREGATE fastunion(geometry);
DROP FUNCTION unite_sfunc(geometry[], geometry);
DROP FUNCTION unite_finalfunc(geometry[]);

CREATE FUNCTION unite_sfunc (geometry[],geometry)
        RETURNS geometry[]
        AS '/usr/src/postgis/postgis/libpostgis.so.0.8'
        LANGUAGE 'C' WITH (isstrict);

CREATE FUNCTION unite_finalfunc (geometry[])
        RETURNS geometry
        AS '/usr/src/postgis/postgis/libpostgis.so.0.8'
        LANGUAGE 'C' WITH (isstrict);

CREATE AGGREGATE fastunion (
        initcond = '{}', -- needed for basetype != style && sfunc isstrict
        sfunc = unite_sfunc,
        basetype = geometry,
        stype = geometry[],
        finalfunc = unite_finalfunc
);

--8<------------------------------------------------------------------


Have fun.

PS: using fastunion in a GREOUP BY query gives me a segfault,
    still inspecting it.


-strk;

pramsey wrote:
> Go for it.
> P.
> 
> strk wrote:
> 
> > pramsey wrote:
> > 
> >>strk wrote:
> >>
> >>
> >>>If 'fastunion' is a good name for you I'll commit, so we can test
> >>>togheter. 
> >>
> >>Lets think about this. If the fastunion in fact takes up no more space 
> >>than the regular union, then perhaps we can simply use it with the name 
> >>as the geomunion(A,B)?
> >>
> >>Then we have:
> >>
> >>geomunion(A,B)
> >>geomunion(recordset)
> >>memgeomunion(recordset) for the future slow'n'steady version?
> > 
> > 
> > I can do the following:
> > 	- commit changes to geomUnion() for soon-memory-release
> > 	- commit support routines for "fast" union
> > 	- post on the mailing list SQL query to enable/disable "fast" union
> > In this way we can test both of them on different dataset.
> > 
> > Fundamentally the point is the the "WORST" case memory occupation
> > will be about the same, while the "BEST" case memory occupation
> > will be MUCH less with the old code.
> > 
> > Imagine 3000 square polygons whose union makes a rectangle :)
> > Old way will take up  (releasing memory soon) a rectangle size memory.
> > New way will take up 3000 * square size memory (before staring to release it)
> > 
> > What do you think ?
> > 
> > --strk;
> > 
> > _______________________________________________
> > geos-devel mailing list
> > geos-devel at geos.refractions.net
> > http://geos.refractions.net/mailman/listinfo/geos-devel
> 
> 
> -- 
>        __
>       /
>       | Paul Ramsey
>       | Refractions Research
>       | Email: pramsey at refractions.net
>       | Phone: (250) 885-0632
>       \_
> 
> 
> _______________________________________________
> geos-devel mailing list
> geos-devel at geos.refractions.net
> http://geos.refractions.net/mailman/listinfo/geos-devel



More information about the geos-devel mailing list