[postgis-devel] Avoid unnecessary memory copy in gserialized_datum_get_box2df_p

Paul Ramsey pramsey at cleverelephant.ca
Wed Oct 2 06:33:27 PDT 2013


The reason I sliced was because we were seeing big pain for larger objects, and also because it seemed to make sense to read just a little piece rather than the whole geometry, particularly if there was a decompress step, or the whole object would have to be read into memory. What's going to happen to us for larger geometries? 

P 

-- 
Paul Ramsey
http://cleverelephant.ca
http://postgis.net


On Tuesday, October 1, 2013 at 8:39 PM, Yuto HAYAMIZU wrote:

> Hi Sandro,
> 
> > good catch !
> 
> Thanks :)
> 
> > So is PG_DETOAST_DATUM a no-op for non-external and non-compressed
> > values ?
> 
> 
> 
> That's right.
> PG_DETOAST_DATUM is an alias to pg_detoast_datum, and the function just 
> returns datum itself if it is non-external and non-compressed.
> http://doxygen.postgresql.org/fmgr_8h.html#af0f04d284da4bbefa0b99119cfcb54f1
> 
> 
> > The only other use of PG_DETOAST_DATUM_SLICE is in ST_IsCollection,
> > may be worth fixing that too.
> > Have you profiled other geometry types or postgresql version ?
> > --strk;
> > ------------------------------
> 
> 
> 
> No, I haven't, but maybe a several kinds of geometry types can enjoy the 
> benefit of this patch, because gserialized_datum_get_box2df_p is one of 
> the most frequently called functions during GiST index scan of any kind of 
> 2d gserialized datum.
> Key properties:
> * somewhat small gserialized datum (not-external and not-compressed)
> * pre-added bounding box by PostGIS_AddBBox
> If a datum has no pre-added bbox, bbox creation is executed after 
> detoast_slice in the function. Bbox creation is so heavy that improvement 
> by this patch become negligible.
> 
> I'm really new to PostGIS and do not have variations of dataset with 
> geometry types.
> I'll welcome additional profiling tests from anyone.
> 
> ----
> Yuto HAYAMIZU
> _______________________________________________
> postgis-devel mailing list
> postgis-devel at lists.osgeo.org (mailto:postgis-devel at lists.osgeo.org)
> http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-devel






More information about the postgis-devel mailing list