<br><font size=2><tt>> This is probably one of those cases where a fuller
explanation of your <br>
> problem would help. What are you calculating distances *for*, what
are <br>
> your inputs, desired outputs, general description of the problem.
It is <br>
> possible that a different approach to your problem could yeild a better
<br>
> result.<br>
</tt></font>
<br><font size=2><tt>I thought I had! :)</tt></font>
<br>
<br><font size=2><tt>I've got 54,000 polygons covering an area of 611,000
hectares.  These polygons represent forest cover types and they are
uniquely identified with a field called link.  The table is called
vri_polygons.</tt></font>
<br>
<br><font size=2><tt>I have another table with road linework.  95,000
features spread over the exact same landbase.  The table is called
trim_roads.</tt></font>
<br>
<br><font size=2><tt>What I want to do is calculate the shortest distance
from each polygon to each road.  I want a list of link's and a minium
distance to roads.</tt></font>
<br>
<br><font size=2><tt>Here's what I initially did but found performance
and memory usage went gonzo.</tt></font>
<br>
<br><font size=2><tt>CREATE table vri_road_dist as </tt></font>
<br><font size=2><tt>(</tt></font>
<br><font size=2><tt>SELECT vri.link, min(distance(vri.wkb_geometry,roads.wkb_geometry)::integer)
AS MIN_ROAD_DIST</tt></font>
<br><font size=2><tt>FROM vri_polygons vri, trim_roads roads</tt></font>
<br><font size=2><tt>GROUP BY vri.link</tt></font>
<br><font size=2><tt>);</tt></font>
<br>
<br><font size=2><tt>I assume this forces a cartesian join and tries to
load both intersecting tables into RAM?  Both tables have GIST indexes.</tt></font>
<br>
<br><font size=2><tt>Tyler</tt></font>