Re: Short-circuit sort_inner_and_outer if there are no mergejoin clauses - Mailing list pgsql-hackers

From Richard Guo
Subject Re: Short-circuit sort_inner_and_outer if there are no mergejoin clauses
Date
Msg-id CAMbWs4_B=C-KaD+VGuXa61XKzJa-9F+tFw4JQDdN-Ztnuxj3bA@mail.gmail.com
Whole thread Raw
In response to Re: Short-circuit sort_inner_and_outer if there are no mergejoin clauses  (Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>)
Responses Re: Short-circuit sort_inner_and_outer if there are no mergejoin clauses
List pgsql-hackers

On Thu, Apr 25, 2024 at 7:25 PM Ashutosh Bapat <ashutosh.bapat.oss@gmail.com> wrote:
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 
 

pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: Sequence Access Methods, round two
Next
From: Frédéric Yhuel
Date:
Subject: Re: New GUC autovacuum_max_threshold ?