[postgis-devel] Avoid unnecessary memory copy in gserialized_datum_get_box2df_p
Yuto HAYAMIZU
yuto at hayamiz.com
Tue Oct 1 19:39:57 PDT 2013
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
More information about the postgis-devel
mailing list