[postgis-users] Points-in-polygon performance

Robin Chauhan robin.chauhan at gmail.com
Thu Dec 20 13:48:20 PST 2007


I have a region_polygons table where region_polygons.rpg_geom is a
MULTIPOLYGON.
I want to select rows in the geom_table where geom_table.geom_fld is within
region_polygons.rpg_geom

The following idiom works for me, but is waaaay slow (whereas I found other
kinds of spatial queries are pretty zippy):

SELECT * from geom_table where EXISTS
                (select rpg_id from region_polygons where
                geom_fld && rpg_geom and intersects(geom_fld, rpg_geom) and
rpg_name='GVRD_OLD')

Where should I start?

a) Simplify the multipolygon?
b) Joins instead of EXISTS?
c) Would putting the literal WK format for the polygon right into the SQL
query help?
d) ... or something else?

-- 
Robin R Chauhan
Pathway Intelligence Inc
robin at pathwayintelligence.com
604-886-3964
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20071220/593440ad/attachment.html>


More information about the postgis-users mailing list