Re: An improvement on parallel DISTINCT

2024-02-07 Thread David Rowley
On Mon, 5 Feb 2024 at 14:42, Richard Guo wrote: > > > On Fri, Feb 2, 2024 at 7:36 PM David Rowley wrote: >> I think we should just make it work the same way as >> create_grouping_paths(), where grouping_target is passed as a >> parameter. >> >> I've done it that way in the attached. > > > The cha

Re: An improvement on parallel DISTINCT

2024-02-04 Thread Richard Guo
On Fri, Feb 2, 2024 at 7:36 PM David Rowley wrote: > Now for the other stuff you had. I didn't really like this part: > > + /* > + * Set target for partial_distinct_rel as generate_useful_gather_paths > + * requires that the input rel has a valid reltarget. > + */ > + partial_distinct_rel->relt

Re: An improvement on parallel DISTINCT

2024-02-04 Thread Richard Guo
On Fri, Feb 2, 2024 at 6:39 PM David Rowley wrote: > So the gains increase with more parallel workers due to pushing more > work to the worker. Amdahl's law approves of this. > > I'll push the patch shortly. Thanks for the detailed testing and pushing the patch! Thanks Richard

Re: An improvement on parallel DISTINCT

2024-02-02 Thread David Rowley
On Fri, 2 Feb 2024 at 23:39, David Rowley wrote: > I'll push the patch shortly. I've pushed the partial path sort part. Now for the other stuff you had. I didn't really like this part: + /* + * Set target for partial_distinct_rel as generate_useful_gather_paths + * requires that the input rel

Re: An improvement on parallel DISTINCT

2024-02-02 Thread David Rowley
On Fri, 2 Feb 2024 at 20:47, Richard Guo wrote: > > > On Fri, Feb 2, 2024 at 11:26 AM David Rowley wrote: >> >> In light of this, do you still think it's worthwhile making this change? >> >> For me, I think all it's going to result in is extra planner work >> without any performance gains. > > >

Re: An improvement on parallel DISTINCT

2024-02-01 Thread Richard Guo
On Fri, Feb 2, 2024 at 11:26 AM David Rowley wrote: > In light of this, do you still think it's worthwhile making this change? > > For me, I think all it's going to result in is extra planner work > without any performance gains. Hmm, with the query below, I can see that the new plan is cheaper

Re: An improvement on parallel DISTINCT

2024-02-01 Thread David Rowley
On Wed, 27 Dec 2023 at 00:23, Richard Guo wrote: > -- on master > EXPLAIN (costs off) > SELECT DISTINCT four FROM tenk1; > QUERY PLAN > > Unique >-> Sort > Sort Key: four > -> Gather >