[postgis-users] relationship functions not working well

William Kyngesburye woklist at kyngchaos.com
Fri Dec 5 11:30:59 PST 2008


On Dec 5, 2008, at 1:02 PM, Paul Ramsey wrote:

> add
>
> wkb_geometry && SetSRID('BOX3D(-162 55,-161 56)'::box3d,4326)
>
> to your where clause to engage the index.
>
> P
>
Do you mean just that, without the st_relate?  That gives exactly the  
same results as st_intersects, though may be a little faster since it  
skips the full intersection test.

Or replace the st_intersects half?  Again, probably slightly faster.

Doesn't help the st_relate half in a large box selection.


>> Well, that works:
>>
>> ST_relate(wkb_geometry, SetSRID('BOX3D(-162 55,-161 56)'::box3d, 
>> 4326),
>> 'T********')
>>
>> But it's painfully slow - looks like relate doesn't do an index  
>> bounding box
>> test.
>>
>> ... added a normal intersect (it's a superset of what I want) and let
>> short-circuit logic take care of the initial selection:
>>
>> ST_Intersects(wkb_geometry, SetSRID('BOX3D(-162 55,-161 56)'::box3d, 
>> 4326))
>> AND ST_relate(wkb_geometry, SetSRID('BOX3D(-162 55,-161 56)'::box3d, 
>> 4326),
>> 'T********')
>>
>> That's reasonably fast, for a small box at least.  It will likely  
>> slow down
>> on a larger box.
>>
>> -----
>> William Kyngesburye <kyngchaos*at*kyngchaos*dot*com>
>> http://www.kyngchaos.com/
>>
>> "Those people who most want to rule people are, ipso-facto, those  
>> least
>> suited to do it."
>>
>> - A rule of the universe, from the HitchHiker's Guide to the Galaxy
>>
>>
>> _______________________________________________
>> postgis-users mailing list
>> postgis-users at postgis.refractions.net
>> http://postgis.refractions.net/mailman/listinfo/postgis-users
>>
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users

-----
William Kyngesburye <kyngchaos*at*kyngchaos*dot*com>
http://www.kyngchaos.com/

"Those people who most want to rule people are, ipso-facto, those  
least suited to do it."

- A rule of the universe, from the HitchHiker's Guide to the Galaxy





More information about the postgis-users mailing list