<div dir="ltr"><div class="gmail_default" style="font-family:tahoma,sans-serif">Yeah, I noticed that. Yes, both tables have the same number of rows (2,502). That 15,812 number is showing up in the 12 plan in the ProjectSet node. </div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">Shira</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jan 9, 2020 at 1:24 PM Paul Ramsey <<a href="mailto:pramsey@cleverelephant.ca">pramsey@cleverelephant.ca</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">according to the explain the seqscan at the bottom of the plan is scanning and returning only 5x more rows in 9.6. are the tables really the same size?<br>
<br>
> On Jan 9, 2020, at 12:47 PM, Shira Bezalel <<a href="mailto:shira@sfei.org" target="_blank">shira@sfei.org</a>> wrote:<br>
> <br>
> Hi List,<br>
> <br>
> This is a "yeah, but why?" type of question. <br>
> <br>
> I'm testing an upgrade from<br>
> <br>
> Postgres 9.6 and PostGIS 2.3<br>
> <br>
> to <br>
> <br>
> Postgres 12.1 and PostGIS 3.0<br>
> <br>
> One of our queries has gone from about 80 seconds to 30 seconds on the new releases, which is great, but I'm just trying to figure out why. I realize there are a host of different reasons why performance changes may result across different versions and servers, but just wondering if it's related to a specific performance enhancement in Postgres or PostGIS. Can't seem to find anything in the release notes that would explain it.<br>
> <br>
> I've narrowed down the improvement to the part of the larger query that issues an ST_ValueCount() against a large raster and then sums the results. I can replicate the improvement with this simpler query subset:<br>
> <br>
> SELECT pvc.value, SUM(pvc.count) AS sum <br>
> FROM <br>
> (SELECT (ST_ValueCount(cv.rast, 1)).* <br>
> FROM calveg_whrtype_20m AS cv) AS pvc <br>
> GROUP BY pvc.value<br>
> <br>
> 9.6 plan<br>
> 12.0 plan<br>
> <br>
> Anything jump out as the reason for the improved plan in terms of changes to Postgres or PostGIS? Something to do with the HashAggregate it seems, but not sure why. And yes, this may have nothing to do with PostGIS per se, so feel free to point me over to the Postgres Performance list, if so. Just thought I'd start here since the raster function is involved. <br>
> <br>
> Thanks much!<br>
> Shira<br>
> <br>
> <br>
> <br>
>  <br>
> _______________________________________________<br>
> postgis-users mailing list<br>
> <a href="mailto:postgis-users@lists.osgeo.org" target="_blank">postgis-users@lists.osgeo.org</a><br>
> <a href="https://lists.osgeo.org/mailman/listinfo/postgis-users" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/postgis-users</a><br>
<br>
_______________________________________________<br>
postgis-users mailing list<br>
<a href="mailto:postgis-users@lists.osgeo.org" target="_blank">postgis-users@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/postgis-users" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/postgis-users</a></blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div><font color="#666666" face="tahoma, sans-serif" size="2">Shira Bezalel </font></div><div><font color="#666666" face="tahoma, sans-serif" size="2">Database Administrator & Desktop Support </font><span style="color:rgb(102,102,102);font-family:tahoma,sans-serif;font-size:small">Manager</span></div><div><font color="#666666" face="tahoma, sans-serif" size="2">San Francisco Estuary Institute</font></div><div><font color="#666666" face="tahoma, sans-serif" size="2"><a href="http://www.sfei.org" target="_blank">www.sfei.org</a></font></div><div><font color="#666666" face="tahoma, sans-serif" size="2">Ph: 510-746-7304</font></div></div><div style="font-weight:bold;font-style:normal;font-variant:normal;line-height:20px;margin:0px"><br style="color:rgb(0,0,0);font-family:Tahoma;font-size:13px;font-weight:normal;line-height:normal"></div>
<div style="padding-top:8px">
         </div></div></div></div></div></div></div>