[postgis-devel] Float vs Double Box

Nicklas Avén nicklas.aven at jordogskog.no
Wed Nov 9 12:09:51 PST 2011


Another aspect of double vs float is that the float boxes might give
wrong ordering from knn-gist.

In other cases we can round the float box up to a slightly bigger box,
but in the ordering case that will not help.

That is why we get different answer from native Postgresql knn and
PostGIS as I discussed the other week, because Postgresql is not using
the bbox but the point itself. I'm I right or have I misunderstood?

/Nicklas



On Wed, 2011-11-09 at 10:52 -0800, Paul Ramsey wrote:
> On Wed, Nov 9, 2011 at 10:47 AM, Sandro Santilli <strk at keybit.net> wrote:
> > On Wed, Nov 09, 2011 at 09:43:14AM -0800, Paul Ramsey wrote:
> >> So, we've had this argument before, and Mark wanted double boxes for
> >> simplicity, and I wanted float boxes to keep index sizes down.
> >>
> >> And I realized on the way into work that actually we could have both,
> >> in that we could serialized double boxes into the geometry objects,
> >> but build the index out of float boxes, since the *key* used by the
> >> index is actually a different structure from the geometries
> >> themselves.
> >>
> >> My objection to doubles in the serialization was more concerned with
> >> index size than object size, since for small objects (points,
> >> two-vertex lines) we can just omit the boxes entirely. My objection to
> >> doubles for the index stands, 50% smaller is a big win for an index,
> >> but we can actually have float based indexes and double based
> >> serialization.
> >>
> >> Anyhow, that's the good news.
> >>
> >> The bad news it it's another dump/restore change that touches quite a
> >> pile of critical code, and we're supposed to be feature freezing in a
> >> couple weeks.
> >
> > It's not a new feature, and people would need to dump/reload anyway
> > when coming from postgis < 2.0. I'm more concerned about alignment.
> 
> Well, if we don't do it on this round, it's a dump/reload potentially,
> though as you note we could use version flags...
> 
> > Will your coordinates still be aligned by changing that ?
> 
> Yes, we'll still be aligned.
> 
> > Also, are we caching 2d boxes always, even for 3d or 4d geoms ?
> 
> We're always caching a box with the dimension of the underlying
> object, though for indexes we're building with 2d boxes or n-d boxes
> depending on the gist ops chosen.
> 
> > Could be another nice thing to change.
> > BTW, did you leave a few zeroed-out bit to use for next time we need
> > to do such changes ? It would allow us to do w/out a dump/reload.
> 
> Ensuring the remaining flags are zeroed is still an open ticket, but
> there is a ticket.
> 
> p.
> 
> > --strk;
> >
> >  ()   Free GIS & Flash consultant/developer
> >  /\   http://strk.keybit.net/services.html
> > _______________________________________________
> > postgis-devel mailing list
> > postgis-devel at postgis.refractions.net
> > http://postgis.refractions.net/mailman/listinfo/postgis-devel
> >
> _______________________________________________
> postgis-devel mailing list
> postgis-devel at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-devel
> 





More information about the postgis-devel mailing list