Re: delete on table with many partitions uses a lot of ram - Mailing list pgsql-general

From David Rowley
Subject Re: delete on table with many partitions uses a lot of ram
Date
Msg-id CAKJS1f9RAA6+L=0zSdJMVtn=opbbMU7qEargGuPC07a1QbPtNA@mail.gmail.com
Whole thread Raw
In response to delete on table with many partitions uses a lot of ram  (reg_pg_stefanz@perfexpert.ch)
Responses Re: delete on table with many partitions uses a lot of ram
List pgsql-general
On Sun, 10 Mar 2019 at 10:20, <reg_pg_stefanz@perfexpert.ch> wrote:
> I noticed that a delete on a table with many partitions seems to be
> using a lot of ram.

> Is this a known behaviour or related to my setup?

Yeah, It's known. There's a warning against what you're doing in
https://www.postgresql.org/docs/10/ddl-partitioning.html

I see that note has been changed in v11's documents, but I really
don't think v11 should have changed that. The memory problem still
exists with v11.  The only thing that was improved on that front was
with how partition pruning works, which only saves CPU, not RAM.

It's down to how DELETE and UPDATE plans are generated with
partitioned table or inheritance parents.   The memory growth is
basically quadratic with the number of partitions.  It's possible we
may have a solution for this by the time PostgreSQL 13 is out, but it
won't be fixed for 12.  However, nothing is entirely certain that far
out.

It's probably best to reduce the number of partitions.

-- 
 David Rowley                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services


pgsql-general by date:

Previous
From: reg_pg_stefanz@perfexpert.ch
Date:
Subject: delete on table with many partitions uses a lot of ram
Next
From: reg_pg_stefanz@perfexpert.ch
Date:
Subject: Re: delete on table with many partitions uses a lot of ram