From: Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
To: Mark Magnus <mark.magnus@impactdata.com.au>
To: pgsql-bugs@postgresql.org
Subject: Re: Postgres 10.3 delete on partition table cannot execute, out of memory.
Date: Fri, 16 Mar 2018 14:32:44 +0900
Message-ID: <fecdef72-8c2a-0794-8e0a-2ad76db82c68@lab.ntt.co.jp> (raw)
In-Reply-To: <CAHQZHJ4DWi-toRxWAFNGrdqZsj_3tRq7t+79AJfCo3qSQkix+Q@mail.gmail.com>
References: <CAHQZHJ4DWi-toRxWAFNGrdqZsj_3tRq7t+79AJfCo3qSQkix+Q@mail.gmail.com>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: Langote_Amit_f8@lab.ntt.co.jp, mark.magnus@impactdata.com.au
Subject: Re: Postgres 10.3 delete on partition table cannot execute, out of memory.
In-Reply-To: <fecdef72-8c2a-0794-8e0a-2ad76db82c68@lab.ntt.co.jp>
References: <CAHQZHJ4DWi-toRxWAFNGrdqZsj_3tRq7t+79AJfCo3qSQkix+Q@mail.gmail.com> <fecdef72-8c2a-0794-8e0a-2ad76db82c68@lab.ntt.co.jp>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox