"Mason Hale" <masonhale@gmail.com> writes:
> SELECT target_page_id, min(created_at)
> FROM page_page_link
> GROUP BY 1;
> The page_page_link table has ~130 million rows.
> After analyzing the table, the planner picks a hash aggregate plan, which
> results in an out of memory error.
What have you got work_mem set to? What's the actual number of groups
(target_page_id values)?
regards, tom lane