[postgis-users] Need help concatentating 60, 000 polygon geometries
Paul Ramsey
pramsey at refractions.net
Thu Oct 4 13:31:32 PDT 2007
Counter-intuitively, do this (collecting all your smaller geometries
into one big one to test other features for containment) is probably
going to make your system SLOWER for any given containment query.
As a collection of small objects, the index system can partition out the
few small objects that need to be tested for any given candidate
feature. As a single large object, the same large object will have to be
de-serialized, and every edge of that object tested against the candidate.
Paul
Kevin Neufeld wrote:
> Scott Schulthess wrote:
>>
>> Hello everyone,
>>
>>
>>
>> I have a table with 60,000 rows.
>>
>>
>>
>> Each row has a geometry field that is a polygon.
>>
>>
>>
>> I want to concatenate all of these geometry objects into one big
>> multipolygon, or at the very least, a polygon, so I can query easily
>> on one geometry object to see if a point lies within that multipolygon.
>>
>> ...
>>
> Use collect(geometry set).
>
> CREATE TABLE my_multi_polygon AS
> SELECT collect(geom) AS geom
> FROM my_poly_table;
>
> -------------
> Kevin Neufeld
> Software Developer
> Refractions Research Inc.
> 300-1207 Douglas St.
> Victoria, B.C., V8W 2E7
>
> Phone: (250) 383-3022
> Email: kneufeld at refractions.net
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users
--
Paul Ramsey
Refractions Research
http://www.refractions.net
pramsey at refractions.net
Phone: 250-383-3022
Cell: 250-885-0632
More information about the postgis-users
mailing list