Out of Memory during Insert - Mailing list pgsql-general

From yue peng
Subject Out of Memory during Insert
Date
Msg-id e8b67231003240357j566a4dfcpdda77a762cf6d7a9@mail.gmail.com
Whole thread Raw
Responses Re: Out of Memory during Insert  (Thom Brown <thombrown@gmail.com>)
Re: Out of Memory during Insert  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
Dear, Psqlers,

I encountered an out of memory error during executing un INSERT into table1(v1,v2,v3) SELECT  c1,c2,c3 from table2 where .....
The recordset of Select query  is around 30M record. And I got following Message :

 -------  ERROR: out of memoryDETAIL: Failed on request of size 40.' in 'insert into  -------------------

I found my postgresql process used up 3G Memory . I guess postgresql try to first get all the result of select , and then insert into Table . As the process can't allocate more memory for result of select , and then I got OOM error. Can someone verify my guess ? Or what else could be the reason of OOM ?

Is there any other ways to still insert same amount of data and avoid this OOM error ?

Thanks ,
--
Yue

pgsql-general by date:

Previous
From: Nilesh Govindarajan
Date:
Subject: Re: Help me with this multi-table query
Next
From: Thom Brown
Date:
Subject: Re: Out of Memory during Insert