From: | Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com> |
---|---|
To: | alvherre(at)alvh(dot)no-ip(dot)org |
Cc: | amitlangote09(at)gmail(dot)com, keisuke(dot)kuroda(dot)3862(at)gmail(dot)com, tatsuro(dot)yamada(dot)tf(at)nttcom(dot)co(dot)jp, pgsql-hackers(at)lists(dot)postgresql(dot)org, tatsuhito(dot)kasahara(dot)rd(at)hco(dot)ntt(dot)co(dot)jp |
Subject: | Re: Huge memory consumption on partitioned table with FKs |
Date: | 2020-12-04 03:05:22 |
Message-ID: | 20201204.120522.2170603007747047845.horikyota.ntt@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Thanks, but sorry for the confusion.
I intended just to show how it looks like if we share
RI_ConstraintInfo among partition relations.
At Thu, 3 Dec 2020 10:22:47 -0300, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> wrote in
> Hello
>
> I haven't followed this thread's latest posts, but I'm unclear on the
> lifetime of the new struct that's being allocated in TopMemoryContext.
> At what point are those structs freed?
The choice of memory context is tentative and in order to shrink the
patch'es footprint. I think we don't use CurrentDynaHashCxt for the
additional struct so a context for this use is needed.
The struct is freed only when the parent struct (RI_ConstraintInfo) is
found to be able to share the child struct (RI_ConstraintParam) with
the parent constraint. It seems like inefficient (or tending to make
"hole"s in the heap area) but I chose it just to shrink the footprint.
We could create the new RI_ConstraintInfo on stack then copy it to the
cache after we find that the RI_ConstraintInfo needs its own
RI_ConstriantParam.
> Also, the comment that was in RI_ConstraintInfo now appears in
> RI_ConstraintParam, and the new struct (RI_ConstraintInfo) is now
> undocumented. What is the relationship between those two structs? I
> see that they have pointers to each other, but I think the relationship
> should be documented more clearly.
I'm not sure the footprint of this patch worth doing but here is a bit
more polished version.
regards.
--
Kyotaro Horiguchi
NTT Open Source Software Center
Attachment | Content-Type | Size |
---|---|---|
0001-separte-riinfo.patch | text/x-patch | 28.0 KB |
0002-share-param-part-of-riinfo.patch | text/x-patch | 3.2 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Hou, Zhijie | 2020-12-04 03:13:42 | RE: A new function to wait for the backend exit after termination |
Previous Message | Bharath Rupireddy | 2020-12-04 03:00:17 | Re: [bug fix] ALTER TABLE SET LOGGED/UNLOGGED on a partitioned table does nothing silently |