Re: ATTACH/DETACH PARTITION CONCURRENTLY

From: Amit Langote <amitlangote09(at)gmail(dot)com>
To: michael(at)paquier(dot)xyz
Cc: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>, Robert Haas <robertmhaas(at)gmail(dot)com>, David Rowley <david(dot)rowley(at)2ndquadrant(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Simon Riggs <simon(at)2ndquadrant(dot)com>
Subject: Re: ATTACH/DETACH PARTITION CONCURRENTLY
Date: 2018-11-16 04:54:30
Message-ID: CA+HiwqE7pJ7f3GcRWTfpdE-DQLsXg74R8PMvw43ivXDM1EzQJg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Nov 16, 2018 at 1:00 PM Michael Paquier <michael(at)paquier(dot)xyz> wrote:
> On Fri, Nov 16, 2018 at 10:57:57AM +0900, Amit Langote wrote:
> > Maybe partition_bounds_create() should've had a MemoryContext argument to
> > pass it the context we want it to create the PartitionBoundInfo in. That
> > way, we can simply pass rd_pdcxt to it and avoid making a copy. As is,
> > we're now allocating two copies of PartitionBoundInfo, one in the
> > CurrentMemoryContext and another in rd_pdcxt, whereas the previous code
> > would only allocate the latter. Maybe we should fix it as being a regression.
>
> Not sure about what you mean by regression here,

The regression is, as I mentioned, that the new code allocates two
copies of PartitionBoundInfo whereas only one would be allocated
before.

> but passing the memory
> context as an argument has sense as you can remove the extra partition
> bound copy, as it has sense to use an array instead of a list for
> performance, which may matter if many partitions are handled when
> building the cache. So cleaning up both things at the same time would
> be nice.

Maybe, the patch to add the memory context argument to
partition_bound_create and other related static functions in
partbound.c should be its own patch, as that seems to be a separate
issue. OTOH, other changes needed to implement Robert's proposal of
using PartitionBoundSpec and Oid arrays instead of existing lists
should be in the same patch.

Thanks,
Amit

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message John Naylor 2018-11-16 05:01:36 Re: [RFC] Removing "magic" oids
Previous Message Dilip Kumar 2018-11-16 04:16:27 Re: Undo logs