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 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.
--
David Rowley http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services