[postgis-users] Accelerating spatial queries

Paul Ramsey pramsey at refractions.net
Tue Aug 15 14:18:58 PDT 2006


The performance gain is probably actually a result of doing N  
topological tests against simple geometries instead N against complex  
geometries.  Big polygons with lots of vertices are expensive to do  
topological tests against.  By cutting things up with a grid, you are  
providing simple inputs for most of the tests.

I *thought* we had implemented some short-circuit tests for cases  
where building a complete topology graph was not necessary, like  
point-in-polygon.  In general there is still probably a good deal of  
optimization left to be had in the GEOS/PostGIS duality, if anyone is  
interested in tracking it down.

P


On 15-Aug-06, at 2:10 PM, trevorw wrote:

> I've discovered that in cases when one is overlaying a moderate number
> of points (6,000 - 80,000) against an area file with a limited number
> (1 - 50) of polygons, significant performance gains can be achieved by
> cutting apart the target polygons with a grid. My assumption is that
> this gives smaller bounding boxes and gives better performance  
> using the
> a.the_geom && b.the_geom statement prior to contains or other  
> functions.
>
> Now when doing this on an ongoing basis, it is simple to create a  
> layer
> that is cut into blocks to speed performance. It might however be nice
> to create a function that would create a temporary table on the fly
> which would enable this performance gain without having to manually
> generate duplicates of different spatial layers in the system. Has
> anyone considered or implemented this kind of optimization?
>
> T
> -- 
> Trevor Wiens
> trevorw at fanweb.ca
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users




More information about the postgis-users mailing list