Re: Incorrect comment in get_partition_dispatch_recurse - Mailing list pgsql-hackers

From Amit Langote
Subject Re: Incorrect comment in get_partition_dispatch_recurse
Date
Msg-id 6d73cbf0-f10e-6769-7e02-b4f7a406102f@lab.ntt.co.jp
Whole thread Raw
In response to Re: Incorrect comment in get_partition_dispatch_recurse  (David Rowley <david.rowley@2ndquadrant.com>)
List pgsql-hackers
On 2018/05/18 6:14, David Rowley wrote:
> On 18 May 2018 at 02:13, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Maybe what you need is a redesign.  This convention seems impossibly
>> confusing and hence error-prone.  What about using a separate bool to
>> indicate which list the index refers to?
> 
> While I agree that the coding is a bit unusual, I think it's also good
> that we can get away without allocating yet another array nparts in
> size. ExecSetupPartitionTupleRouting is already a huge bottleneck with
> single-row INSERT into a partitioned table with a large number of
> partitions. Allocating yet another array nparts in size will just slow
> it down further.

I recall having considered the idea of adding an array of bools, but went
with the negative-indexes-for-partitioned-tables idea anyway, which I
remember was suggested by Robert back then [1].  I admit it's a bit
confusing, but it's nice not have one more array allocation in that path
as you say.

> I have patches locally that I'll be submitting during the v12 cycle to
> improve on this. Among other things, the patches go to lengths to not
> allocate these arrays when we don't have to.

That would be nice.

Thanks,
Amit

[1]
https://www.postgresql.org/message-id/CA%2BTgmobF2r%3Df-crrE-k7WM8iFpBKLz3dtBtEc%3DKmkudYViYcyQ%40mail.gmail.com



pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: Postgres 11 release notes
Next
From: Michael Paquier
Date:
Subject: Re: SCRAM with channel binding downgrade attack