[postgis-devel] [PostGIS] #547: ST_contains memory problem when used between polygon and mixed geometry

PostGIS trac at osgeo.org
Mon Jun 28 09:20:00 PDT 2010


#547: ST_contains memory problem when used between polygon and mixed geometry
--------------------------------+-------------------------------------------
 Reporter:  twain               |       Owner:  pramsey      
     Type:  defect              |      Status:  new          
 Priority:  high                |   Milestone:  PostGIS 1.5.2
Component:  postgis             |     Version:  1.5.X        
 Keywords:  ST_contains memory  |  
--------------------------------+-------------------------------------------
 Tested with postgis 1.5.1:

 The following query uses large amounts of memory (multiple GB depending on
 the number of rows)

 select ST_Contains(source.geometry, placex.geometry) from placex, placex
 as source where source.place_id = 59001169 and source.geometry &&
 placex.geometry;

 where source.geometry is a polygon or multipolygon.

 if the query is restricted to:

 select ST_Contains(source.geometry, placex.geometry) from placex, placex
 as source where source.place_id = 59001169 and source.geometry &&
 placex.geometry and  ST_geometrytype(placex.geometry) = 'ST_Point';

 OR

 select ST_Contains(source.geometry, placex.geometry) from placex, placex
 as source where source.place_id = 59001169 and source.geometry &&
 placex.geometry and  ST_geometrytype(placex.geometry) != 'ST_Point';

 neither of these queries has high memory usage.

 In the original case all memory is freed when the query completed but
 given a large number of rows (10000+) it can use up all the memory in the
 machine causing it to swap and eventually kill the process.

 As far as I can tell there is nothing special about the source polygons /
 multi polygon - any polygon shows this behaviour.

-- 
Ticket URL: <http://trac.osgeo.org/postgis/ticket/547>
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