Re: Reordering DISTINCT keys to match input path's pathkeys

2024-11-25 Thread Richard Guo
On Tue, Nov 26, 2024 at 10:22 AM Richard Guo wrote: > On Tue, Nov 26, 2024 at 10:12 AM Tom Lane wrote: > > Richard Guo writes: > > > I've applied some of the changes you suggested in your previous email > > > and pushed the updated patch. Thank you for your review. > > The buildfarm's not too

Re: Reordering DISTINCT keys to match input path's pathkeys

2024-11-25 Thread Richard Guo
On Tue, Nov 26, 2024 at 10:12 AM Tom Lane wrote: > Richard Guo writes: > > I've applied some of the changes you suggested in your previous email > > and pushed the updated patch. Thank you for your review. > > The buildfarm's not too happy. It looks like this patch decided > to use the name "di

Re: Reordering DISTINCT keys to match input path's pathkeys

2024-11-25 Thread Tom Lane
Richard Guo writes: > I've applied some of the changes you suggested in your previous email > and pushed the updated patch. Thank you for your review. The buildfarm's not too happy. It looks like this patch decided to use the name "distinct_tbl" in a test script that runs in parallel with anoth

Re: Reordering DISTINCT keys to match input path's pathkeys

2024-11-25 Thread Richard Guo
On Tue, Nov 26, 2024 at 9:43 AM Richard Guo wrote: > I've applied some of the changes you suggested in your previous email > and pushed the updated patch. Thank you for your review. Ah, the buildfarm is complaining. I shouldn't create tables with the same name in two test files. Fixing ... Th

Re: Reordering DISTINCT keys to match input path's pathkeys

2024-11-25 Thread Richard Guo
On Fri, Nov 22, 2024 at 5:40 PM Andrei Lepikhov wrote: > I wonder if it would be possible to print only three rows instead of 10 > to prove the DISTINCT's correctness. There are ten distinct values in the 'distinct_tbl' test table, so I think it’d better to print all of them to verify correctness

Re: Reordering DISTINCT keys to match input path's pathkeys

2024-11-22 Thread Andrei Lepikhov
On 11/13/24 13:49, Richard Guo wrote: On Mon, Oct 28, 2024 at 6:15 PM Andrei Lepikhov wrote: On 6/7/24 16:46, Richard Guo wrote: I'm not sure about merging these two 'reordering' GUCs into one. While they may look similar, they apply to very different scenarios. However, I'm open to other sugg

Re: Reordering DISTINCT keys to match input path's pathkeys

2024-11-14 Thread Andrei Lepikhov
On 11/14/24 08:09, Richard Guo wrote: On Wed, Nov 13, 2024 at 7:36 PM Andrei Lepikhov wrote: On 11/13/24 13:49, Richard Guo wrote: In thread [1], I try to add one more strategy that minimises the number of comparison operator calls. It seems that it would work the same way with the DISTINCT sta

Re: Reordering DISTINCT keys to match input path's pathkeys

2024-11-13 Thread Richard Guo
On Wed, Nov 13, 2024 at 7:36 PM Andrei Lepikhov wrote: > On 11/13/24 13:49, Richard Guo wrote: > > Thanks for reviewing this patch. After some consideration, I think > > it's not too complex to also apply this optimization to DISTINCT ON. > > The parser already ensures that the DISTINCT ON expres

Re: Reordering DISTINCT keys to match input path's pathkeys

2024-11-13 Thread Andrei Lepikhov
On 11/13/24 13:49, Richard Guo wrote: On Mon, Oct 28, 2024 at 6:15 PM Andrei Lepikhov wrote: On 6/7/24 16:46, Richard Guo wrote: This patch does not apply any more, so here is a new rebase, with some tweaks to the comments. This patch needs a minor rebase again. After skimming the code, I w

Re: Reordering DISTINCT keys to match input path's pathkeys

2024-11-12 Thread Richard Guo
On Mon, Oct 28, 2024 at 6:15 PM Andrei Lepikhov wrote: > On 6/7/24 16:46, Richard Guo wrote: > > This patch does not apply any more, so here is a new rebase, with some > > tweaks to the comments. > This patch needs a minor rebase again. > After skimming the code, I want to say that it looks good.

Re: Reordering DISTINCT keys to match input path's pathkeys

2024-10-28 Thread Andrei Lepikhov
On 6/7/24 16:46, Richard Guo wrote: On Mon, Feb 5, 2024 at 11:18 AM Richard Guo wrote: cfbot reminds that this patch does not apply any more. So I've rebased it on master, and also adjusted the test cases a bit. This patch does not apply any more, so here is a new rebase, with some tweaks to

Re: Reordering DISTINCT keys to match input path's pathkeys

2024-06-07 Thread Richard Guo
On Mon, Feb 5, 2024 at 11:18 AM Richard Guo wrote: > cfbot reminds that this patch does not apply any more. So I've rebased > it on master, and also adjusted the test cases a bit. This patch does not apply any more, so here is a new rebase, with some tweaks to the comments. Thanks Richard v3-

Re: Reordering DISTINCT keys to match input path's pathkeys

2024-02-04 Thread Richard Guo
cfbot reminds that this patch does not apply any more. So I've rebased it on master, and also adjusted the test cases a bit. Thanks Richard v2-0001-Reordering-DISTINCT-keys-to-match-input-path-s-pathkeys.patch Description: Binary data

Re: Reordering DISTINCT keys to match input path's pathkeys

2024-01-26 Thread Richard Guo
On Tue, Jan 23, 2024 at 5:03 PM David Rowley wrote: > I've not caught up on the specifics of 0452b461b, but I just wanted to > highlight that there was some work done in [1] in this area. It seems > Ankit didn't ever add that to a CF, so that might explain why it's > been lost. > > Anyway, just

Re: Reordering DISTINCT keys to match input path's pathkeys

2024-01-23 Thread David Rowley
On Tue, 23 Jan 2024 at 18:56, Richard Guo wrote: > > Similar to what we did to GROUP BY keys in 0452b461bc, I think we can do > the same to DISTINCT keys, i.e. reordering DISTINCT keys to match input > path's pathkeys, which can help reduce cost by avoiding unnecessary > re-sort, or allowing us to

Re: Reordering DISTINCT keys to match input path's pathkeys

2024-01-23 Thread Laurenz Albe
On Tue, 2024-01-23 at 13:55 +0800, Richard Guo wrote: > Similar to what we did to GROUP BY keys in 0452b461bc, I think we can do > the same to DISTINCT keys, i.e. reordering DISTINCT keys to match input > path's pathkeys, which can help reduce cost by avoiding unnecessary > re-sort, or allowing us