[postgis-users] Speed up query

Gheorghiu, Mihai mgheorghiu at chpmail.com
Wed Oct 19 09:21:02 PDT 2011

I have a query that places points in polygons:
insert into results (
                select a.point_id, b.polygon_id
                from  points a, polygons b
                where st_contains(ST_GeomFromWKB(ST_AsBinary(b.geog),4326),ST_GeomFromWKB(ST_AsBinary(a.geog),4326)) = 't'
There are ~1M points and ~300k polygons. There are geo indexes on the geog columns of both tables.
What changes would make the query faster?

Thank you very much.


The information contained in this transmission is to be considered CONFIDENTIAL and PROPRIETARY to Consortium Health Plans, Inc. and intended for the use of the Individual or Entity named above.  If the reader of this message is not the Intended Recipient, you are hereby notified that any dissemination, distribution, or copying of this communication is Strictly Prohibited.  If you have received this transmission in error, please notify us immediately by telephone at 410-772-2900 or return email to sender immediately.  Thank You.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20111019/dfc20392/attachment.html>

More information about the postgis-users mailing list