On 2018/06/27 14:55, Andres Freund wrote: > On 2018-06-27 14:46:26 +0900, Amit Langote wrote: >> There is however similar code that runs in non-error paths, such as in >> ExecPrepareTupleRouting(), that is executed *if* the leaf partition and >> the root parent have differing attribute numbers. So, one might say that >> that code's there to handle the special cases which may not arise much in >> practice, but it may still be a good idea to make improvements if we can >> do so. > > Yea, I was referring to all do_convert_tuple() callers, and some of them > are more hot-path than the specific one above. E.g. the > ConvertPartitionTupleSlot() call in CopyFrom().
Just in case you haven't noticed, ConvertPartitionTupleSlot(), even if it's called unconditionally from CopyFrom etc., calls do_convert_tuple only if necessary. Note the return statement at the top of its body. HeapTuple ConvertPartitionTupleSlot(TupleConversionMap *map, HeapTuple tuple, TupleTableSlot *new_slot, TupleTableSlot **p_my_slot) { if (!map) return tuple; map is non-NULL only if a partition has different attribute numbers than the root parent. Thanks, Amit