[postgis-users] Optimizing ST_Intersection

vinod.khare at gmail.com vinod.khare at gmail.com
Tue Sep 27 13:56:46 PDT 2011


I have a table containing all roads in the US. Naturally, this table is very
large with more that 20 million rows. I want to find the intersection of
these roads with a single linestring (representing a pipeline).

SELECT ST_AsText(ST_Intersection(
    (SELECT the_geom FROM roads)
    (SELECT the_geom FROM pipes WHERE pipeid = 1)));

I have created a gist index on roads but the query planner does not use it.
The query takes a really long time. Is there some way to optimize this?

thanks,
Vinod.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20110927/d5ab9c6f/attachment.html>


More information about the postgis-users mailing list