<div dir="ltr">Can you redo that EXPLAIN with EXPLAIN ANALYZE VERBOSE? That'll give use what the database actually does...</div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, May 28, 2015 at 8:09 AM, Alexander W. Rolek <span dir="ltr"><<a href="mailto:a.rolek@gmail.com" target="_blank">a.rolek@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><span style="font-size:12.8000001907349px">I appreciate the quick responses. Here's the EXPLAIN for the following query:</span><div><br style="font-size:12.8000001907349px"><div style="font-size:12.8000001907349px">EXPLAIN</div><div style="font-size:12.8000001907349px">SELECT DISTINCT</div><div style="font-size:12.8000001907349px"><span style="white-space:pre-wrap">     </span>parcel.apn</div><div style="font-size:12.8000001907349px">FROM </div><div style="font-size:12.8000001907349px"><span style="white-space:pre-wrap">    </span><span>gis</span>.parcels as parcel, </div><div style="font-size:12.8000001907349px"><span style="white-space:pre-wrap"> </span><span>gis</span>.layers as layer </div><div style="font-size:12.8000001907349px">WHERE </div><div style="font-size:12.8000001907349px"><span style="white-space:pre-wrap">       </span><a href="http://layer.id/" target="_blank">layer.id</a> = 339 AND </div><div style="font-size:12.8000001907349px"><span style="white-space:pre-wrap">      </span>ST_Intersects(layer.geom_4326, parcel.geom_4326);</div><div style="font-size:12.8000001907349px"><br></div><div style="font-size:12.8000001907349px">Output:</div><div style="font-size:12.8000001907349px"><br></div><div style="font-size:12.8000001907349px"><div>"HashAggregate  (cost=543.84..805.23 rows=26139 width=11)"</div><div>"  Group Key: parcel.apn"</div><div>"  ->  Nested Loop  (cost=5.40..478.49 rows=26139 width=11)"</div><div>"        ->  Index Scan using layers_pkey on layers layer  (cost=0.27..8.29 rows=1 width=56409)"</div><div>"              Index Cond: (id = 339)"</div><div>"        ->  Bitmap Heap Scan on parcels parcel  (cost=5.13..469.83 rows=37 width=1018)"</div><div>"              Recheck Cond: (layer.geom_4326 && geom_4326)"</div><div>"              Filter: _st_intersects(layer.geom_4326, geom_4326)"</div><div>"              ->  Bitmap Index Scan on parcels_geom_4326  (cost=0.00..5.12 rows=111 width=0)"</div><div>"                    Index Cond: (layer.geom_4326 && geom_4326)"</div></div><div style="font-size:12.8000001907349px"><br></div><div style="font-size:12.8000001907349px"><br></div><span style="font-size:12.8000001907349px">@Steve.Toutant, I tried your approach, but I'm still getting really slow queries(minutes). Any other ideas?</span><span class="HOEnZb"><font color="#888888"><br></font></span></div><span class="HOEnZb"><font color="#888888"><div><span style="font-size:12.8000001907349px"><br></span></div><div><span style="font-size:12.8000001907349px">Alexander Rolek</span></div></font></span></div>
<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>