From: Michael Lewis <mlewis@xxxxxxxxxxx> Sent: Wednesday, July 21, 2021 18:12 To: ldh@xxxxxxxxxxxxxxxxxx Cc: pgsql-performance@xxxxxxxxxxxxxx Subject: Re: Big performance slowdown from 11.2 to 13.3 I'm not seeing the valueof the CTE. Why not access assessmenticcqa_raw directly in the main query and only do GROUP BY once? Do you have many values in iccqar_ques_code which are not used in this query? Yes, there are close to 600 different values, and we are picking up only a small amount. And by the way, this is a classic case where the query could be folder as a sub-select in a join clause, and I tried this as well, with the same results. Thank you, Laurent.