You might provide a description of the tables (\d xxxx at the psql prompt), and perhaps the output of an "EXPLAIN ANALYZE" for this command. Any non-standard config settings might be of relevance as well.
Greg Williamson ----- Original Message ----- > From: Stefan Keller <[email protected]> > To: PostGIS Users Discussion <[email protected]> > Cc: > Sent: Thursday, February 16, 2012 3:51 PM > Subject: [postgis-users] ST_Crosses doesn't use index? > > 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 > _______________________________________________ > postgis-users mailing list > [email protected] > http://postgis.refractions.net/mailman/listinfo/postgis-users > _______________________________________________ postgis-users mailing list [email protected] http://postgis.refractions.net/mailman/listinfo/postgis-users
