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

Andrea Peri 2007 aperi2007 at gmail.com
Thu Sep 23 09:52:35 PDT 2010



>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 :)

ok, I'm very glad to know this.

Now I need just another little step to complete the question:

The bounding-box intersection used in the ST_Intersects is used even 
when there isn't an index available on geometry field ?

Thx for clarification.

Andrea.


Il 23/09/2010 18:36, Vincent Picavet ha scritto:
> 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
>




More information about the postgis-users mailing list