[postgis-devel] Caching Double-based Boxes

Paul Ramsey pramsey at opengeo.org
Thu Nov 24 14:13:01 PST 2011


http://svn.osgeo.org/postgis/spike/pramsey/doublebox

We've been around the horn on this issue a number of times...
- Mark has stated his preference for having double boxes cached with
the geometries
- Sandro wants to ensure that the bbox attribute of lwgeom is
deterministic with respect to the underlying content
- Nik wants the indexes to be double based so the distance queries on
the index are deterministic with respect to the underlying content
This change goes 2/3 of the way there.
It alters the gserialized byte stream so that the cached box is a
double box instead of a float box
It continues to use float boxes as the key in the indexes
It continues to use float boxes for operator tests (&&, &&&)
It ensures (probably, I had to remove some recent hooks Sandro added)
that the bbox on the lwgeom is the double-based minimum bounding
rectangle, always, not sometimes
Because the index keys remain floats the index distance searches (<#>,
<->) will continue to be sloppy.

As far as I can see, the main gain is that when you deserialize a
geometry, the bbox hanging off the lwgeom is always going to be exact.
The downside is that the on disk size of the geometries (though not
the indexes) is going to be larger. The worse case scenario is the
three-point-line which will be 28% larger under this regime.

I'm interested to hear if we want to commit to this change, or just
leave well-enough alone and stick with floats in the serialization.

P.



More information about the postgis-devel mailing list