[postgis-devel] [PostGIS] #1798: Performance issue with ST_Intersects(geometry, geometry)

PostGIS trac at osgeo.org
Wed May 2 15:52:13 PDT 2012


#1798: Performance issue with ST_Intersects(geometry,geometry)
---------------------+------------------------------------------------------
 Reporter:  nicklas  |       Owner:  pramsey      
     Type:  defect   |      Status:  new          
 Priority:  medium   |   Milestone:  PostGIS 2.0.1
Component:  postgis  |     Version:  2.0.x        
 Keywords:           |  
---------------------+------------------------------------------------------
 When answering [http://gis.stackexchange.com/questions/24554/looking-for-
 fastest-solution-for-point-in-polygon-analysis-of-200-million-points this]
 question I found to my surprise that in this case ST_DWithin was quite a
 lot faster than ST_Intersects when doing point in polygon test.

 ST_DWithin was actually about 3 times faster.

 What I think I have found is that in some situations the ST_Intersects
 function doesn't get the geometries in the expected order. That means that
 the prepared polygon gets wasted and the preparation needs to be redone
 next time the same polygon appears.

 That is the only explanation I can find from the testing I did, that  in
 those situations the preparation of the polygons gets really expensive.

 It seems like a working index on the geometries guarantees the geometries
 to arrive as wanted. But without the index the &&-operator seems to mess
 up the order. But I haven't relly seem the pattern how index and &&
 operator affects the order.

-- 
Ticket URL: <http://trac.osgeo.org/postgis/ticket/1798>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.


More information about the postgis-devel mailing list