[postgis-devel] What's the point of this exercise in intersects?

Mark Leslie mrk.leslie at gmail.com
Mon Sep 8 21:10:01 PDT 2008


Obe, Regina wrote:
>
> You guys are going to hate me.  My C'est La Vie was short-lived.  It
> just occurred to me
> unless my understanding of how PostgreSQL and PostGIS works is wrong.
>
> Even if you don't have indexes on your geometry isn't the implicit
>
> && going to force a bounding box check still and since operators have
> higher priority, wouldn't that still be run before the
> _ST_Intersects etc. The check in intersects etc. doesn't even work if
> there is no bounding box around the geometry, does a on the fly buffer
> ever have a bounding box?
>
> Explain that to me Mark and perhaps I can be blissful again.
>
> Thanks,
> Regina
>
Why can't you be happy with bliss?

You are correct though, any use of ST_Intersects on an unindexed pair of
geometries will result in something like this:
Join Filter: ((a.the_geom && b.the_geom) AND _st_intersects(a.the_geom,
b.the_geom))

As for the generated geometries, they are automatically generated in a
number of cases, which are documented somewhere in the code.  I don't
recall what they all were were, but they included such vague cases as,
'sufficiently complex geometries,' as well as some quite specific ones,
such as 'never on points'.

I will note that it requires both geometries to be unindexed before no
index scan will be performed, so it's not a huge subset of queries.

-- 
Mark Leslie
Geospatial Software Architect
LISAsoft

-------------------------------------------------------------
Ph: +61 2 8570 5000 Fax: +61 2 8570 5099 Mob: +61 
Suite 112, Jones Bay Wharf 19-21 Pirrama Rd Pyrmont NSW 2009
-------------------------------------------------------------

LISAsoft is part of the A2end Group of Companies
http://www.ardec.com.au
http://www.lisasoft.com
http://www.terrapages.com




More information about the postgis-devel mailing list