[postgis-users] ST_Crosses doesn't use index?
Stefan Keller
sfkeller at gmail.com
Thu Feb 16 15:51:25 PST 2012
Hi
ST_Crosses doc says that it uses the spatial index (if available).
But I'm afraid it's not. I'm using PostGIS 1.5 on Linux.
-- as it should be:
SELECT name
FROM osm_line a, osm_line b
WHERE a.osm_id != b.osm_id
AND ST_Crosses(a.way, b.way)
-- takes longer than 60 sec, 586 features.
-- now with ST_Contains:
SELECT name
FROM osm_line a, osm_line b
WHERE ST_Contains('BOX(8.775 47.245, 8.873 47.208'::box2d,a.way)
AND ST_Contains('BOX(8.775 47.245, 8.873 47.208'::box2d,b.way)
AND a.osm_id != b.osm_id
AND ST_Crosses(a.way, b.way)
-- takes 3.5sec, 586 features.
Obviously ST_Crosses does not consider the geometry index.
Why this?
Yours, Stefan
More information about the postgis-users
mailing list