<div dir="ltr">Hey Richard,<div>I may be completely wrong, but maybe you could use ST_DWithin instead of Buffer+intersect.</div><div>It is usually a good boost in perf, but maybe you absolutely need this shrinking.<br></div>
<div><br></div><div>In the same way I'm not sure the way this query is written is the best (you really need a subquerry here?).<br><br></div><div>I'm guessing you don't have a simple index on your "name" from "special_district", it will accelerate it.</div>
<div>(<span style="background-color:rgb(247,247,247);color:rgb(0,0,0);font-size:1.3em">CREATE INDEX ON </span>special_district <span style="background-color:rgb(247,247,247);color:rgb(0,0,0);font-size:1.3em">(</span>name<span style="background-color:rgb(247,247,247);color:rgb(0,0,0);font-size:1.3em">);</span>)</div>
<div><br></div><div>Last thing is you may consider to protect your column name "owner" and "name" as these are reserved sql word, using doublequote</div><div><br></div><div>Hope it helps =)</div><div><br>
Cheers,</div><div>Rémi-C</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/11/8 Sandro Santilli <span dir="ltr"><<a href="mailto:strk@keybit.net" target="_blank">strk@keybit.net</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On Fri, Nov 08, 2013 at 07:58:45AM -0700, Richard Greenwood wrote:<br>
> I have a query that runs in <1 second on one machine and 47 seconds on<br>
> another. The postgres and postgis versions are bascially the same. The<br>
> database and query are the same. But "explain" is different on the two. The<br>
> query is below and the graphic output of pgAdmin explain is attached.<br>
> Obviously, my question is - why the difference?<br>
<br>
</div>Different statistics gathered ? Try running ANALYZE on both systems.<br>
Different cost configuration ? Compare postgresql.conf.<br>
<br>
--strk;<br>
_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@lists.osgeo.org">postgis-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users" target="_blank">http://lists.osgeo.org/cgi-bin/mailman/listinfo/postgis-users</a><br>
</blockquote></div><br></div>