[postgis-devel] performance of force_collection()

Ron Mayer rm_postgis at cheapcomplexdevices.com
Fri Feb 25 01:12:55 PST 2005


In a couple posts strk at refractions.net wrote:
>On Fri, Feb 25, 2005 at 12:30:37AM -0800, Ron Mayer wrote:
>> Is there a quick way of detecting the bounding box cache ..
>This can be done - see TYPE_HASBBOX macro.

>>> Just another note. Your patch is not forcing a copy on DETOAST.
>> ...I should have checked ... == COLLECTIONTYPE
>Yes, that would be safe.

Thanks.   So if I understand right, this seems totally harmless
and can avoid potentially significant overhead:

======================================================================
% diff -u lwgeom_functions_basic.c.bak  lwgeom_functions_basic.c
--- lwgeom_functions_basic.c.bak	2005-02-25 01:04:35.049758952 -0800
+++ lwgeom_functions_basic.c	2005-02-25 01:04:42.559617280 -0800
@@ -1282,6 +1282,10 @@
 	LWGEOM *lwgeoms[1];
 	LWGEOM *lwgeom;
 
+       if ( TYPE_GETTYPE(geom->type) == COLLECTIONTYPE &&
+            lwgeom_hasBBOX(geom->type) )
+               PG_RETURN_POINTER(geom);
+
 	// deserialize into lwgeoms[0]
 	lwgeom = lwgeom_deserialize(SERIALIZED_FORM(geom));

=====================================================================

and provides a way to let an unpatched mapserver avoid the overhead
of excessively processing large geometries by letting me make the
big geometries in my tables a 2D GEOMETRYCOLLECTION ?

If so, does that seem good for the real postgis?



More information about the postgis-devel mailing list