[postgis-devel] Recheck Considered Harmful (or, at least, Slow)

David Fuhry dfuhry at acm.org
Sun Oct 12 15:39:29 PDT 2008


Paul Ramsey wrote:
> The only downside I can see is that, for very small objects and
> objects without bounding boxes (points) it is hard to avoid detoasting
> *twice*, once to see if the bbox is there, and a second time after the
> first attempt fails.

For 2D points with no SRID, your PG_DETOAST_DATUM_SLICE call has already 
pulled all of the data, right?  (VARHDRSZ + 1 + sizeof(BOX2DFLOAT4) == 
VARHDRSZ + 1 + sizeof(double) * 2)  If you have it pull four more bytes, 
data retrieved by the _SLICE call can cover the 2D-point-with-SRID case, 
too.

-Dave



More information about the postgis-devel mailing list