Skip to content

OOM Killer Triggered During Large Parallel Inserts into Tables with Explicit Primary Keys #39

@Serge-sudo

Description

@Serge-sudo

On a machine equipped with 32 GB of RAM, PostgreSQL with OrioleDB encounters a critical memory exhaustion issue when performing large-scale data inserts into tables that define an explicit primary key.

The problem manifests during a workload that performs parallel INSERT operations into four different OrioleDB tables, each of which has a primary key defined. After running for some time, the PostgreSQL process gradually consumes all available system memory, eventually triggering the Linux OOM killer, which forcibly terminates the PostgreSQL backend.

Following an in-depth investigation of PostgreSQL memory contexts, it was observed that the vast majority of the memory is allocated within the ExecutorState memory context. This context continues to grow throughout the execution of the INSERT workload and is not released in a timely manner, leading to unbounded memory consumption.

To facilitate analysis and reproduction of the issue, a reproducer script is attached below.

reproduce_oom.sh

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions