A query like SELECT region, COUNT(*) FROM sales GROUP BY region folds many rows together, collapsing each group into a single value. This folding of many rows into one is aggregation, and COUNT , SUM , AVG are the familiar examples. PostgreSQL handles aggregation in the execution plan with one ...

Source: [Dev.to](https://dev.to/joonghyukshin/146-aggregate-cost-choosing-hashagg-vs-groupagg-457i)

Sponsored