Re: Postgres 10.3 delete on partition table cannot execute, out of memory.

From: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>
To: Mark Magnus <mark(dot)magnus(at)impactdata(dot)com(dot)au>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: Postgres 10.3 delete on partition table cannot execute, out of memory.
Date: 2018-03-16 05:32:44
Message-ID: fecdef72-8c2a-0794-8e0a-2ad76db82c68@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi.

On 2018/03/15 13:15, Mark Magnus wrote:
> Bug
>
> Partitioned table has 7202 partitions. No partition contains more than 50
> records. Partitioning is done on a foreign key. Any delete operation i.e.
> "delete from contacts where id = ?" or
> "delete from contacts where id = ? and account_id = ?" or
> "delete from contacts where account_id = ?"
> results in out of memory condition.
>
> Default Postgres Configuration with exception
> max_locks_per_transaction = 1024

As Fabio says, it seems most likely that OOM was triggered while planning
the delete operation. I can reproduce OOM being triggered on my modest
development machine, so perhaps that's what's happening in your case too.

This is unfortunately expected, given that the underlying planning
mechanism cannot cope beyond a few hundred partitions. :-( See a relevant
note in the documentation; last line of the page at this link:
https://www.postgresql.org/docs/devel/static/ddl-partitioning.html.

Until things improve in that area, one workaround might be to perform the
delete operation directly on the partition, as it's possible to do that.
Or redesign your schema to use less number of partitions.

Thanks,
Amit

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message alertas 2018-03-16 07:29:45 Re: BUG #15108: Initialization problem postgresql-10-setup initdb
Previous Message Andres Freund 2018-03-16 00:15:44 Re: BUG #15114: logical decoding Segmentation fault