Conversation

This Tweet was deleted by the Tweet author. Learn more
It's not the other way around? HashAggregate becomes a GroupAggregate? The latter is able to spill to disk. (But I could believe that you have it right because HashAggregate is usually much faster.)
This Tweet was deleted by the Tweet author. Learn more
This Tweet was deleted by the Tweet author. Learn more
This Tweet was deleted by the Tweet author. Learn more
It's weird. I suspect that the planner's grouping estimates are way off here. Postgres 13 probably won't do this, since hash aggs can spill. The planner therefore doesn't try to avoid them entirely. The v13 planner would still "be wrong", but with fewer/no actual consequences.