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

---------------------------(end of broadcast)---------------------------
TIP 4: Have you searched our list archives?

              http://archives.postgresql.org

Reply via email to