[postgis-users] ST_Intersects Vs. ST_Intersection

Ahmad Aburizaiza ahmadoa4 at gmail.com
Sun Dec 2 08:43:58 PST 2012

Hello everyone,

I have quick questions please about ST_Intersects Vs. ST_Intersection:

   1. Does the following SQL statement checks the intersection between each
   geom in table1 Vs. each geom in table2?
   SELECT ST_Intersection(table1.geom, table2.geom)
   From table1, table2;
   2. I have 300 lines in table1 and 600 lines in table2. ST_Intersects
   takes about 10 seconds to run while ST_Intersection takes more than 35
   seconds. Isn't both check for intersections first which should take the
   long time needed?
   3. I am trying to find the intersection points between lines in table1
   and table2. What I am doing now is using ST_Intersects in PHP code to
   collect gids from both tables of the lines that intersects and than
   ST_Intersections on the gids found from both tables. If someone nows a
   better solution, can you please advise?

Thank you all,
Ahmad Aburizaiza
PhD student at George Mason University
Geography and Geoinformation Science Department
Fairfax, VA, USA
Tel : +1-703-981-0354*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20121202/2308bfee/attachment.html>

More information about the postgis-users mailing list