Re: MergeJoin beats HashJoin in the case of multiple hash clauses

2025-04-24 Thread Tender Wang
Tender Wang 于2025年4月14日周一 14:17写道: > Hi, > > While I debug hashjoin codes, in estimate_multivariate_bucketsize(), I > find that > the list_copy(hashclauses) below is unnecessary if we have a single join > clause. > > List *clauses = list_copy(hashclauses); > ... > > I adjust the place of l

Re: MergeJoin beats HashJoin in the case of multiple hash clauses

2025-04-14 Thread Tender Wang
Hi, While I debug hashjoin codes, in estimate_multivariate_bucketsize(), I find that the list_copy(hashclauses) below is unnecessary if we have a single join clause. List *clauses = list_copy(hashclauses); ... I adjust the place of list_copy() call as the attached patch. This can save som

Re: MergeJoin beats HashJoin in the case of multiple hash clauses

2025-04-11 Thread Alexander Korotkov
On Fri, Apr 11, 2025 at 5:06 AM Andres Freund wrote: > On 2025-04-11 00:47:19 +0200, Matthias van de Meent wrote: > > On Fri, 11 Apr 2025 at 00:27, Andres Freund wrote: > > > > > > Hi, > > > > > > On 2025-03-09 14:13:52 +0200, Alexander Korotkov wrote: > > > > I've revised commit message, comment

Re: MergeJoin beats HashJoin in the case of multiple hash clauses

2025-04-10 Thread Andres Freund
Hi, On 2025-04-11 00:47:19 +0200, Matthias van de Meent wrote: > On Fri, 11 Apr 2025 at 00:27, Andres Freund wrote: > > > > Hi, > > > > On 2025-03-09 14:13:52 +0200, Alexander Korotkov wrote: > > > I've revised commit message, comments, formatting etc. > > > I'm going to push this if no objection

Re: MergeJoin beats HashJoin in the case of multiple hash clauses

2025-04-10 Thread Matthias van de Meent
On Fri, 11 Apr 2025 at 00:27, Andres Freund wrote: > > Hi, > > On 2025-03-09 14:13:52 +0200, Alexander Korotkov wrote: > > I've revised commit message, comments, formatting etc. > > I'm going to push this if no objections. > > I'm rather confused as to why this is a thing to push at this point? Th

Re: MergeJoin beats HashJoin in the case of multiple hash clauses

2025-04-10 Thread Andres Freund
Hi, On 2025-03-09 14:13:52 +0200, Alexander Korotkov wrote: > I've revised commit message, comments, formatting etc. > I'm going to push this if no objections. I'm rather confused as to why this is a thing to push at this point? This doesn't seem to be a bugfix and it's post feature freeze. Andr

Re: MergeJoin beats HashJoin in the case of multiple hash clauses

2025-03-09 Thread Alexander Korotkov
On Wed, Mar 5, 2025 at 4:43 AM Alexander Korotkov wrote: > > On Mon, Mar 3, 2025 at 10:24 AM Andrei Lepikhov wrote: > > On 17/2/2025 01:34, Alexander Korotkov wrote: > > > Hi, Andrei! > > > > > > On Tue, Oct 8, 2024 at 8:00 AM Andrei Lepikhov wrote: > > > Thank you for your work on this subject.

Re: MergeJoin beats HashJoin in the case of multiple hash clauses

2025-03-04 Thread Alexander Korotkov
On Mon, Mar 3, 2025 at 10:24 AM Andrei Lepikhov wrote: > On 17/2/2025 01:34, Alexander Korotkov wrote: > > Hi, Andrei! > > > > On Tue, Oct 8, 2024 at 8:00 AM Andrei Lepikhov wrote: > > Thank you for your work on this subject. I agree with the general > > direction. While everyone has used conse

Re: MergeJoin beats HashJoin in the case of multiple hash clauses

2025-03-03 Thread Andrei Lepikhov
On 17/2/2025 01:34, Alexander Korotkov wrote: Hi, Andrei! On Tue, Oct 8, 2024 at 8:00 AM Andrei Lepikhov wrote: Thank you for your work on this subject. I agree with the general direction. While everyone has used conservative estimates for a long time, it's better to change them only when we'

Re: MergeJoin beats HashJoin in the case of multiple hash clauses

2025-02-16 Thread Alexander Korotkov
Hi, Andrei! On Tue, Oct 8, 2024 at 8:00 AM Andrei Lepikhov wrote: > On 7/8/24 19:45, Andrei Lepikhov wrote: > > On 3/11/2023 23:43, Tomas Vondra wrote: > >> On 9/11/23 10:04, Lepikhov Andrei wrote: > >> * Determine bucketsize fraction and MCV frequency for the inner > >> * relation. We use th

Re: MergeJoin beats HashJoin in the case of multiple hash clauses

2024-10-07 Thread Andrei Lepikhov
On 7/8/24 19:45, Andrei Lepikhov wrote: On 3/11/2023 23:43, Tomas Vondra wrote: On 9/11/23 10:04, Lepikhov Andrei wrote:   * Determine bucketsize fraction and MCV frequency for the inner   * relation. We use the smallest bucketsize or MCV frequency estimated   * for any individual hashclause; th

Re: MergeJoin beats HashJoin in the case of multiple hash clauses

2024-07-08 Thread Andrei Lepikhov
On 3/11/2023 23:43, Tomas Vondra wrote: On 9/11/23 10:04, Lepikhov Andrei wrote: * Determine bucketsize fraction and MCV frequency for the inner * relation. We use the smallest bucketsize or MCV frequency estimated * for any individual hashclause; this is undoubtedly conservative. I'm sure

Re: MergeJoin beats HashJoin in the case of multiple hash clauses

2023-11-03 Thread Tomas Vondra
On 9/11/23 10:04, Lepikhov Andrei wrote: > > > On Mon, Sep 11, 2023, at 11:51 AM, Andy Fan wrote: >> Hi, >> >> On Thu, Jun 15, 2023 at 4:30 PM Andrey Lepikhov >> wrote: >>> Hi, all. >>> >>> Some of my clients use JOIN's with three - four clauses. Quite >>> frequently, I see complaints on unre

Re: MergeJoin beats HashJoin in the case of multiple hash clauses

2023-09-11 Thread Lepikhov Andrei
On Mon, Sep 11, 2023, at 11:51 AM, Andy Fan wrote: > Hi, > > On Thu, Jun 15, 2023 at 4:30 PM Andrey Lepikhov > wrote: >> Hi, all. >> >> Some of my clients use JOIN's with three - four clauses. Quite >> frequently, I see complaints on unreasonable switch of JOIN algorithm to >> Merge Join in

Re: MergeJoin beats HashJoin in the case of multiple hash clauses

2023-09-10 Thread Andy Fan
Hi, On Thu, Jun 15, 2023 at 4:30 PM Andrey Lepikhov wrote: > Hi, all. > > Some of my clients use JOIN's with three - four clauses. Quite > frequently, I see complaints on unreasonable switch of JOIN algorithm to > Merge Join instead of Hash Join. Quick research have shown one weak > place - esti

Re: MergeJoin beats HashJoin in the case of multiple hash clauses

2023-09-07 Thread Bruce Momjian
Does anyone else have an opinion on this patch? It looks promising. --- On Wed, Jun 28, 2023 at 04:53:06PM +0300, Alena Rybakina wrote: > Hi! > > On 15.06.2023 11:30, Andrey Lepikhov wrote: > > Hi, all. > > Some

Re: MergeJoin beats HashJoin in the case of multiple hash clauses

2023-06-28 Thread Alena Rybakina
Hi! On 15.06.2023 11:30, Andrey Lepikhov wrote: Hi, all. Some of my clients use JOIN's with three - four clauses. Quite frequently, I see complaints on unreasonable switch of JOIN algorithm to Merge Join instead of Hash Join. Quick research have shown one weak place - estimation of an averag