Re: OOM killer while pg_restore

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Marc Rechté <marc4(at)rechte(dot)fr>
Cc: pgsql-performance(at)lists(dot)postgresql(dot)org
Subject: Re: OOM killer while pg_restore
Date: 2022-03-03 15:31:59
Message-ID: 3161846.1646321519@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

=?UTF-8?Q?Marc_Recht=c3=a9?= <marc4(at)rechte(dot)fr> writes:
> We have a pg_restore which fails due to RAM over-consumption of the
> corresponding PG backend, which ends-up with OOM killer.
> The table has one PK, one index, and 3 FK constraints, active while
> restoring.
> The dump contains over 200M rows for that table and is in custom format,
> which corresponds to 37 GB of total relation size in the original DB.

The FKs would result in queueing row trigger events, which would occupy
some memory. But those should only need ~12 bytes per FK per row,
which works out to less than 10GB for this number of rows, so it may
be that you've hit something else that we would consider a leak.

Does memory consumption hold steady if you drop the FK constraints?

If not, as others have noted, we'd need more info to investigate
this. The leak is probably independent of the specific data in
the table, so maybe you could make a small self-contained example
using a script to generate dummy data.

regards, tom lane

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Ranier Vilela 2022-03-03 16:33:08 Re: An I/O error occurred while sending to the backend (PG 13.4)
Previous Message ldh@laurent-hasson.com 2022-03-03 14:55:40 RE: An I/O error occurred while sending to the backend (PG 13.4)