Re: memory usage of group by select

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Cc: Anthony <osm(at)inbox(dot)org>, pgsql-general(at)postgresql(dot)org
Subject: Re: memory usage of group by select
Date: 2009-12-29 22:04:01
Message-ID: 20587.1262124241@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Alvaro Herrera <alvherre(at)commandprompt(dot)com> writes:
> It's expecting 85k distinct groups. If that's not accurate, then
> HashAggregate would use more memory than expected. See if you can make
> it work by setting enable_hashagg = off.

> If that works, good -- the real solution is different. Maybe you need
> to ANALYZE more, or increase the size of the stats bin for this column.

If ANALYZE consistently underestimates the number of distinct values,
you may have to force matters with ALTER TABLE SET STATISTICS DISTINCT.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Anthony 2009-12-29 22:25:35 Re: memory usage of group by select
Previous Message Nick 2009-12-29 21:21:49 Re: Installation of Postgis/postgresql