<div dir="ltr"><div class="gmail_default" style="font-family:tahoma,sans-serif">Hi Giuseppe,</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">Thank you for your reply. I provided the EXPLAIN (ANALYZE ON, BUFFERS ON) output in the links in my initial email. Is that not what you meant?</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">Yes, the config between the two systems is very similar. I'm thinking the shared buffers count differs between the two systems because the row counts themselves are different. But why is that? I think I'll turn this question over to the general Postgres Performance list now.</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 class="gmail_default" style="font-family:tahoma,sans-serif"></div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Jan 9, 2020 at 3:23 PM Giuseppe Broccolo <<a href="mailto:g.broccolo.7@gmail.com" target="_blank">g.broccolo.7@gmail.com</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"><div dir="ltr"><div>Hi Shira,<br><br></div><div>there's the number of shared buffers involved in the hash aggregation that is different in the two execution plans, in PostgreSQL 9.6 the double of the pages are hitten compared to PostgreSQL 12.0. Here I assume that the configuration of the two DB engines is the same (same shared buffers, etc.). It would be good to check buffers behaviour during the query execution. Could you attach the output with the EXPLAIN(ANALYSE, BUFFERS) statement?</div><div><br></div><div>Giuseppe.<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Il giorno gio 9 gen 2020 alle ore 20:48 Shira Bezalel <<a href="mailto:shira@sfei.org" target="_blank">shira@sfei.org</a>> ha scritto:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-family:tahoma,sans-serif">Hi List,</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">This is a "yeah, but why?" type of question. </div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">I'm testing an upgrade from</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">Postgres 9.6 and PostGIS 2.3</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">to </div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">Postgres 12.1 and PostGIS 3.0</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">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.</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">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:</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">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></div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif"><a href="https://explain.depesz.com/s/W8HN" target="_blank">9.6 plan</a></div><div class="gmail_default" style="font-family:tahoma,sans-serif"><a href="https://explain.depesz.com/s/lIRS" target="_blank">12.0 plan</a></div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">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. </div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif">Thanks much!</div><div class="gmail_default" style="font-family:tahoma,sans-serif">Shira</div><div class="gmail_default" style="font-family:tahoma,sans-serif"><br></div><div><br></div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div><div><br></div></div>
<div style="padding-top:8px">
<br></div></div></div></div></div></div>
_______________________________________________<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>
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"><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>