On 10/16/24 01:28, Ba Jinsheng wrote:
> The major differerence between both query plans is the first one has
> additional *SORT*. I believe the second query plan is more efficient.
> Similar to my last report, perhaps we can optimize code to enable it.
I would like to know if you can improve that case by switching from the
sorted group to a hashed one.
I see huge underestimation because of the HAVING clause on an aggregate.
It would be interesting to correct the prediction and observe what will
happen.
Can you reproduce the same query using the SQL server? It would
highlight some techniques Postgres has not adopted yet.
--
regards, Andrei Lepikhov