Quickly looking at the function, the patch would make it more apparent that the function is a noop when mergeclause_list is empty.
Thanks for looking at this patch. Yes, that's what it does.
I haven't looked closely to see if creating unique path nonetheless is useful somewhere else.
It seems that one of the side effects of create_unique_path is that it
caches the generated unique path so that we can avoid creating it
repeatedly for the same rel. But this does not seem to justify calling
create_unique_path when we know it is unnecessary.
Please add to the next commitfest.
Done.
If the patch shows some measurable performance improvement, it would become more attractive.
I doubt that there is measurable performance improvement. But I found
that throughout the run of the regression tests, sort_inner_and_outer is
called a total of 44,424 times. Among these calls, there are 11,064
instances where mergeclause_list is found to be empty. This accounts
for ~1/4. I think maybe this suggests that it's worth the shortcut as
the patch does.
Thanks
Richard