From: | Robert Haas <robertmhaas(at)gmail(dot)com> |
---|---|
To: | Michel Alexandre Salim <michel(dot)salim(at)cs(dot)fau(dot)de> |
Cc: | pgsql-bugs(at)postgresql(dot)org |
Subject: | Re: BUG #5779: Large INSERT transaction with FOREIGN KEY constraints exhausts available RAM |
Date: | 2010-12-14 20:44:47 |
Message-ID: | AANLkTi=51_6R2Smdit3a-sxGt2_4iFreSeYtkgB22N4b@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On Wed, Dec 1, 2010 at 3:09 AM, Michel Alexandre Salim
<michel(dot)salim(at)cs(dot)fau(dot)de> wrote:
> I tried changing the fkey constraints to DEFERRABLE hoping that that would
> consume less RAM, but the same result occurs. Why should the memory usage
> pattern be different when integrity checks are done as part of the
> transaction (even when pushed back to the end), and in a separate
> transaction?
I'm just guessing here, but it may be that the trigger queue is what's
filling up all the memory. I'm guessing that a trigger event is
getting queued for each row you INSERT. But when you add the foreign
key later, it does a bulk validation of the entire table instead of
validating each individual row.
If that really is what's going on here, it's a known shortcoming of
the existing implementation which, unfortunately, no one has gotten
around to fixing (partly because it's not entirely obvious what the
design should be).
--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2010-12-14 20:50:36 | Re: memory leak in xml2 contrib module |
Previous Message | Robert Haas | 2010-12-14 20:41:36 | Re: BUG #5776: Unable to create view with parameter in PL/pgsql |