id summary reporter owner description type status priority milestone component version resolution keywords cc
547 ST_contains memory problem when used between polygon and mixed geometry twain strk "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.
" defect closed blocker PostGIS 1.5.6 postgis 1.5.X fixed ST_contains memory