Re: BUG #5779: Large INSERT transaction with FOREIGN KEY constraints exhausts available RAM

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: BUG #5779: Large INSERT transaction with FOREIGN KEY constraints exhausts available RAM
Дата
Msg-id AANLkTi=51_6R2Smdit3a-sxGt2_4iFreSeYtkgB22N4b@mail.gmail.com
обсуждение исходный текст
Ответ на BUG #5779: Large INSERT transaction with FOREIGN KEY constraints exhausts available RAM  ("Michel Alexandre Salim" <michel.salim@cs.fau.de>)
Список pgsql-bugs
On Wed, Dec 1, 2010 at 3:09 AM, Michel Alexandre Salim
<michel.salim@cs.fau.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

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: BUG #5776: Unable to create view with parameter in PL/pgsql
Следующее
От: Robert Haas
Дата:
Сообщение: Re: memory leak in xml2 contrib module