[postgis-devel] ST_Contains / ST_Within

Paul Ramsey pramsey at cleverelephant.ca
Fri Sep 26 14:51:22 PDT 2014


I was just working through strategy numbers and thinking about how we only ever use RTOverlapStrategyNumber when I realized that we should be using other strategies for at least a few of our functions, and yet we have 

CREATE OR REPLACE FUNCTION ST_Contains(geom1 geometry, geom2 geometry)
        RETURNS boolean
        AS 'SELECT $1 && $2 AND _ST_Contains($1,$2)'
        LANGUAGE 'sql' IMMUTABLE;

When really it should be

CREATE OR REPLACE FUNCTION ST_Contains(geom1 geometry, geom2 geometry)
        RETURNS boolean
        AS 'SELECT $1 ~ $2 AND _ST_Contains($1,$2)'
        LANGUAGE 'sql' IMMUTABLE;

Probably a small efficiency savings to be had in reducing the number of geometries to be exact tested. Anyone see a reason we shouldn’t do this?

P.

-- 
Paul Ramsey
http://cleverelephant.ca
http://postgis.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-devel/attachments/20140926/0b6d9ba8/attachment.html>


More information about the postgis-devel mailing list