[postgis-devel] What's the point of this exercise in intersects?
Obe, Regina
robe.dnd at cityofboston.gov
Wed Sep 10 05:45:17 PDT 2008
> That's not quite true for all cases. If bboxes exist, it should be
the
> same performance per pair as the non-indexed &&, but it will be run on
> fewer pairs when it's redundant, and will improved performance
> considerably when it's not.
I guess my thinking is when you get a lot of positives for a large
polygon area - say
if you wanted to collect all the interesting points that fall in Canada,
you could get maybe 32,000
points going into this redundant bbox check. So even though
comparitively its cheap. cheap * 32000
may not be so cheap.
> There's also the question of what the &&
> operator compares when there are no bboxes. My assumption, which I'm
> open to having corrected, is that it will create bboxes for the
purpose
> of comparison, but will not write it into the geometry.
I suspect you may be right, but then again the way we have the postgis
functions short-circuiting,
you would be paying this penalty anyway. But then again SQL functions
cache. Though I haven't looked at how the operators work, I suspect its
highly likely a
&& call would look something like CAST(geom1 as box2d) && CAST(geom2 As
box2d)
And the casting process would be cached for each unique geometry - so it
would end up creating a bbox only once for each geom. If you consider
that often times the geometry that doesn't have a bbox is probably a
calculated constant in your query, that ends up being only once so
probably very efficient.
> Really, it's the tests that will determine it's value. I may run a
few
> of my own today and see what I get.
That would be great if you get to test it. I'm still fighting with my
various boxes so probably won't be able to get to it for another week.
Thanks,
Regina
-----------------------------------------
The substance of this message, including any attachments, may be
confidential, legally privileged and/or exempt from disclosure
pursuant to Massachusetts law. It is intended
solely for the addressee. If you received this in error, please
contact the sender and delete the material from any computer.
More information about the postgis-devel
mailing list