OOM killer while pg_restore

From: Marc Rechté <marc4(at)rechte(dot)fr>
To: pgsql-performance(at)lists(dot)postgresql(dot)org
Subject: OOM killer while pg_restore
Date: 2022-03-03 08:59:03
Message-ID: 866ba95f-86fb-fa9b-ecee-65281160cff9@rechte.fr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Hello,

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.

While importing, one can see the RSS + swap increasing linearly for the
backend (executing the COPY)

On my machine (quite old PC), it failed after 16 hours, while the disk
usage was reaching 26 GB and memory usage was 9.1g (RSS+swap)

If we do the same test, suppressing firstly the 5 constraints on the
table, the restore takes less than 15 minutes !

This was tested on both PG 14.2 and PG 13.6 (linux 64-bit machines).

It there a memory leak or that is normal that a bacend process may
exhaust the RAM to such an extent ?

Thanks

Regards

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Ranier Vilela 2022-03-03 11:00:38 Re: OOM killer while pg_restore
Previous Message Mladen Gogala 2022-03-02 14:04:20 Re: Simple task with partitioning which I can't realize