[postgis-users] Re: geos based spatial queries

David Blasby dblasby at refractions.net
Mon Nov 24 15:01:54 PST 2003


Peter Aberline wrote:
> I'm currently trying to do a selection using the Query 2 syntax from the
> points table that fall within the US coastline, represented by a 950000
> vertex polygon. The query is selecting from the same points table (1.6
> million records). There are GIST indexes on both table's geometry cols, and
> I'm expecting only a couple of hundred points to fall outside the border.
> This query is performing very, very slowly - it's been going for over 48
> hours now! Does anyone have any idea of why this is taking so long? Is
> query time using "distance" a factor of both the area and number of
> vertices in the containing polygon?

This is taking long because its probably doing 1.6 million 
point-in-polygon operations.


Your polygon is also very large (1 million vertexes).

So, its doing 1.6 million * 1 million operations!


The easiest way to fix this is to break your "continent" in to a large 
number of smaller polygons.


But, you are still going to be doing about 1.6 million point-in-polygons.



















More information about the postgis-users mailing list