[postgis-users] need help optimizing spatial join / intersection query

Mark Phillips mphillip at unca.edu
Fri Jun 20 09:02:47 PDT 2008

Paul  & Martin,

Thanks again for your great suggestions and feedback; I'll try setting up a
script to spread the computations out over multiple cores and see what

In the meantime, in case you or anyone else wants to experiment with the
data I've been using, I've packaged it up and made it available for download


That tarball contains two shapefiles --- one for the drainage basins and one
for the rainfall polygons, and  README file summarizing what I'm trying to

One idea that just occurred to me, which I haven't had time to actually try
yet, would be to first split the rain polygons into smaller pieces, perhaps
by intersecting them with some moderate-sized rectangular grid.    In
general these "rain polygons" are large complicated multipolygons  with a
lot of holes.  It seems conceivable to me that if they were in smaller
chunks, the total processing time for my computation might possibly go down,
because each actual intersection/area calculation would involve a lower
number of vertices.  Of course this would be at the expense of a larger
number of such calculations, so it's not totally clear that it would help,
but it seems like it might, especially since the spatial index will
eliminate a bunch of unnecessary calculations.  I'll give this a  try when I
can find the time and see what happens.  In the meantime, if anyone has any
thoughts about whether this kind of thing would help, let me know!

Thanks again,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20080620/f5b198fb/attachment.html>

More information about the postgis-users mailing list