[postgis-users] Using both && and ST_Intersects in a query

Vincent Picavet vincent.ml at oslandia.com
Thu Sep 23 09:37:39 PDT 2010


Hi,

> this mean that a query filter like this:
> 
> select ...
> from
>    table1 as a,
>    table2 as b
> where
> (  (a.geom && b.geom) && (ST_Intersects(a.geom,b.geom)=true ) )
> 
> if faster than a query without the &&
> like this:
> 
> select ...
> from
>    table1 as a,
>    table2 as b
> where
> (  ST_Intersects(a.geom,b.geom)=true  )

This would be true if ST_Intersects would'nt already include a bounding box 
intersection step before trying the real intersection algorithm.
The magic is already in PostGIS :)

But you can try the difference with _st_intersects, which only does the 
geometric intersection without the bbox comparison first.

Vincent

-- 
Vincent Picavet - vincent.picavet at oslandia.com
www.oslandia.com - Engineering your GIS



More information about the postgis-users mailing list