pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@alvh.no-ip.org>
To: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Cc: keisuke.kuroda.3862@gmail.com
Cc: tatsuro.yamada.tf@nttcom.co.jp
Cc: pgsql-hackers@lists.postgresql.org
Cc: amitlangote09@gmail.com
Cc: tatsuhito.kasahara.rd@hco.ntt.co.jp
Subject: Re: Huge memory consumption on partitioned table with FKs
Date: Mon, 30 Nov 2020 21:03:45 -0300
Message-ID: <20201201000345.GA15098@alvherre.pgsql> (raw)
In-Reply-To: <20201126.121818.26523414172308697.horikyota.ntt@gmail.com>

On 2020-Nov-26, Kyotaro Horiguchi wrote:

> This shares RI_ConstraintInfo cache by constraints that shares the
> same parent constraints. But you forgot that the cache contains some
> members that can differ among partitions.
> 
> Consider the case of attaching a partition that have experienced a
> column deletion.

I think this can be solved easily in the patch, by having
ri_BuildQueryKey() compare the parent's fk_attnums to the parent; if
they are equal then use the parent's constaint_id, otherwise use the
child constraint.  That way, the cache entry is reused in the common
case where they are identical.

I would embed all this knowledge in ri_BuildQueryKey though, without
adding the new function ri_GetParentConstOid.  I don't think that
function meaningful abstraction value, and instead it would make what I
suggest more difficult.





view thread (53+ messages)  latest in thread

Message-ID: <20201201000345.GA15098@alvherre.pgsql>
Permalink:  ../20201201000345.GA15098@alvherre.pgsql/
Also on:    postgresql.org/message-id/20201201000345.GA15098@alvherre.pgsql

reply

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 using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: alvherre@alvh.no-ip.org, horikyota.ntt@gmail.com, keisuke.kuroda.3862@gmail.com, tatsuro.yamada.tf@nttcom.co.jp, pgsql-hackers@lists.postgresql.org, amitlangote09@gmail.com, tatsuhito.kasahara.rd@hco.ntt.co.jp
  Subject: Re: Huge memory consumption on partitioned table with FKs
  In-Reply-To: <20201201000345.GA15098@alvherre.pgsql>

* 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