Re: Out of memory error in 8.1.0 Win32 - Mailing list pgsql-general

From Todd A. Cook
Subject Re: Out of memory error in 8.1.0 Win32
Date
Msg-id 449AE2C6.5080601@blackducksoftware.com
Whole thread Raw
In response to Re: Out of memory error in 8.1.0 Win32  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Out of memory error in 8.1.0 Win32
Re: Out of memory error in 8.1.0 Win32
List pgsql-general
Tom Lane wrote:
>
> Misestimated hash aggregation, perhaps?  What is the query and what does
> EXPLAIN show for it?  What have you got work_mem set to?

oom_test=> \d oom_tab
     Table "public.oom_tab"
  Column |  Type   | Modifiers
--------+---------+-----------
  val    | integer |

oom_test=> explain select val,count(*) from oom_tab group by val;
                                QUERY PLAN
-------------------------------------------------------------------------
  HashAggregate  (cost=1163446.13..1163448.63 rows=200 width=4)
    ->  Seq Scan on oom_tab  (cost=0.00..867748.42 rows=59139542 width=4)

The row estimitate for oom_tab is close to the actual value.  Most of
the values are unique, however, so the result should have around 59M
rows too.

I've tried it with work_mem set to 32M, 512M, 1G, and 2G.  It fails in
all cases, but it hits the failure point quicker with work_mem=32M.

-- todd

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Out of memory error in 8.1.0 Win32
Next
From: Tom Lane
Date:
Subject: Re: auto-vacuum & Negative "anl" Values