Re: Out of Memory during Insert

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: yue peng <pengyuebupt(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Out of Memory during Insert
Date: 2010-03-24 14:30:05
Message-ID: 20969.1269441005@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

yue peng <pengyuebupt(at)gmail(dot)com> writes:
> I encountered an out of memory error during executing un INSERT into
> table1(v1,v2,v3) SELECT c1,c2,c3 from table2 where .....

Most likely the OOM is because of growth of the pending-trigger-event
queue --- do you have any foreign key references in that table?

Possible solutions are to insert fewer rows at a time, or to drop the FK
constraint and then re-create it after you do the bulk insertion.

You might also try updating to a newer PG version ... 8.4 and later use
only 12 bytes per pending INSERT trigger not 40. That's not necessarily
going to be enough to fix this particular case, of course.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tony Webb 2010-03-24 14:51:09 Revoking CREATE TABLE
Previous Message Frank jansen 2010-03-24 14:19:14 Re: Concatenate [solved]