Re: pushdown of joinquals beyond group by/distinct on

2022-04-04 Thread David Rowley
On Tue, 5 Apr 2022 at 07:40, Arne Roland wrote: > can someone point out to me, why we don't consider pushdowns of the joinqual > for these queries beyond the distinct on? > > When the qual matches the distinct clause, it should be possible to generate > both parametrized and non parametrized sub

pushdown of joinquals beyond group by/distinct on

2022-04-04 Thread Arne Roland
Hi, can someone point out to me, why we don't consider pushdowns of the joinqual for these queries beyond the distinct on? When the qual matches the distinct clause, it should be possible to generate both parametrized and non parametrized subplans for the same query. The same should hold true

Is the testing a bit too light on GROUP BY DISTINCT?

2021-06-21 Thread David Rowley
GROUP BY DISTINCT with GROUPING SETS test? Any thoughts? David [1] https://www.postgresql.org/message-id/17067-665d50fa321f7...@postgresql.org

Re: GROUP BY DISTINCT

2021-03-18 Thread Vik Fearing
On 3/19/21 12:52 AM, Tomas Vondra wrote: > > On 3/19/21 12:26 AM, Tom Lane wrote: >> I wrote: >>> This is gcc 4.5, but hopefully whatever shuts it up will also work on 4.7. >>> I'll work on figuring that out. >> >> Actually, the problem is pretty obvious after comparing this use >> of foreach_dele

Re: GROUP BY DISTINCT

2021-03-18 Thread Tomas Vondra
On 3/19/21 12:26 AM, Tom Lane wrote: > I wrote: >> This is gcc 4.5, but hopefully whatever shuts it up will also work on 4.7. >> I'll work on figuring that out. > > Actually, the problem is pretty obvious after comparing this use > of foreach_delete_current() to every other one. I'm not sure wh

Re: GROUP BY DISTINCT

2021-03-18 Thread Tom Lane
I wrote: > This is gcc 4.5, but hopefully whatever shuts it up will also work on 4.7. > I'll work on figuring that out. Actually, the problem is pretty obvious after comparing this use of foreach_delete_current() to every other one. I'm not sure why the compiler warnings are phrased just as they

Re: GROUP BY DISTINCT

2021-03-18 Thread Tom Lane
I wrote: > Hmm ... prairiedog isn't showing the warning, but maybe gaur will. Bingo: parse_agg.c: In function 'expand_grouping_sets': parse_agg.c:1851:5: warning: value computed is not used This is gcc 4.5, but hopefully whatever shuts it up will also work on 4.7. I'll work on figuring that out.

Re: GROUP BY DISTINCT

2021-03-18 Thread Tom Lane
Thomas Munro writes: > On Fri, Mar 19, 2021 at 10:14 AM Tomas Vondra > wrote: >> Thanks for the info. So it's likely related to older gcc releases. The >> question is how to tweak the code to get rid of this ... > It's frustrating to have to do press-ups to fix a problem because a > zombie Debia

Re: GROUP BY DISTINCT

2021-03-18 Thread Thomas Munro
On Fri, Mar 19, 2021 at 10:14 AM Tomas Vondra wrote: > >> The only possibility I can think of is some sort of issue in the old-ish > >> gcc release (4.7.2). > > > > No sure what's going on there, but data points: I tried a 32 bit build > > here (that's the other special thing about lapwing) and di

Re: GROUP BY DISTINCT

2021-03-18 Thread Tomas Vondra
On 3/18/21 10:02 PM, Thomas Munro wrote: > On Fri, Mar 19, 2021 at 8:27 AM Tomas Vondra > wrote: >> Hmmm, this seems to fail on lapwing with this error: >> >> parse_agg.c: In function 'expand_grouping_sets': >> parse_agg.c:1851:23: error: value computed is not used >> [-Werror=unused-value] >>

Re: GROUP BY DISTINCT

2021-03-18 Thread Thomas Munro
On Fri, Mar 19, 2021 at 8:27 AM Tomas Vondra wrote: > Hmmm, this seems to fail on lapwing with this error: > > parse_agg.c: In function 'expand_grouping_sets': > parse_agg.c:1851:23: error: value computed is not used > [-Werror=unused-value] > cc1: all warnings being treated as errors > > That lin

Re: GROUP BY DISTINCT

2021-03-18 Thread Tomas Vondra
On 3/18/21 6:25 PM, Tomas Vondra wrote: > On 3/16/21 3:52 PM, Tomas Vondra wrote: >> >> >> On 3/16/21 9:21 AM, Vik Fearing wrote: >>> On 3/13/21 12:33 AM, Tomas Vondra wrote: Hi Vik, The patch seems quite ready, I have just two comments. >>> >>> Thanks for taking a look. >>>

Re: GROUP BY DISTINCT

2021-03-18 Thread Tomas Vondra
On 3/16/21 3:52 PM, Tomas Vondra wrote: > > > On 3/16/21 9:21 AM, Vik Fearing wrote: >> On 3/13/21 12:33 AM, Tomas Vondra wrote: >>> Hi Vik, >>> >>> The patch seems quite ready, I have just two comments. >> >> Thanks for taking a look. >> >>> 1) Shouldn't this add another for DISTINCT, somewhere

Re: GROUP BY DISTINCT

2021-03-16 Thread Tomas Vondra
On 3/16/21 9:21 AM, Vik Fearing wrote: > On 3/13/21 12:33 AM, Tomas Vondra wrote: >> Hi Vik, >> >> The patch seems quite ready, I have just two comments. > > Thanks for taking a look. > >> 1) Shouldn't this add another for DISTINCT, somewhere in the >> documentation? Now the index points just

Re: GROUP BY DISTINCT

2021-03-16 Thread Vik Fearing
g >From d83e2237578f774aaf356525ce05e00b74081b8c Mon Sep 17 00:00:00 2001 From: Vik Fearing Date: Sun, 21 Feb 2021 10:26:57 +0100 Subject: [PATCH] implement GROUP BY DISTINCT --- doc/src/sgml/queries.sgml | 54 ++ doc/src/sgml/ref/select.sgml | 9 +- s

Re: GROUP BY DISTINCT

2021-03-12 Thread Tomas Vondra
Hi Vik, The patch seems quite ready, I have just two comments. 1) Shouldn't this add another for DISTINCT, somewhere in the documentation? Now the index points just to the SELECT DISTINCT part. 2) The part in gram.y that wraps/unwraps the boolean flag as an integer, in order to stash it in the

Re: GROUP BY DISTINCT

2021-03-02 Thread Georgios
‐‐‐ Original Message ‐‐‐ On Tuesday, March 2, 2021 5:51 PM, Vik Fearing wrote: > On 3/2/21 4:06 PM, Georgios Kokolatos wrote: > > > As a minor gripe, I would note the addition of list_int_cmp. > > The block > > > > - /* Sort each groupset individually */ > > > > > > -

Re: GROUP BY DISTINCT

2021-03-02 Thread Georgios Kokolatos
The following review has been posted through the commitfest application: make installcheck-world: not tested Implements feature: not tested Spec compliant: not tested Documentation:not tested Hi, this is a useful feature, thank you for implementing. I gather that it f

Re: GROUP BY DISTINCT

2021-03-02 Thread Vik Fearing
bfde7118d Mon Sep 17 00:00:00 2001 From: Vik Fearing Date: Sun, 21 Feb 2021 10:26:57 +0100 Subject: [PATCH] implement GROUP BY DISTINCT --- doc/src/sgml/queries.sgml | 41 doc/src/sgml/ref/select.sgml | 9 +- src/backend/catalog/sql_features.txt

Re: GROUP BY DISTINCT

2021-02-21 Thread Vik Fearing
mments' column). > This line: > '+T434GROUP BY DISTINCT YES' > > (A tab at the end will do, I suppose; that's how I fixed the patch locally) Argh. Fixed. Thank you for looking at it! -- Vik Fearing >From d5587ece129fbaf4309ddf48d

Re: GROUP BY DISTINCT

2021-02-21 Thread er
> On 2021.02.21. 13:52 Vik Fearing wrote: > > Attached is a patch to implement this for PostgreSQL. > [] The changed line that gets stuffed into sql_features is missing a terminal value (to fill the 'comments' column). This line: '+T434 GROUP BY DISTINCT

GROUP BY DISTINCT

2021-02-21 Thread Vik Fearing
When combining multiple grouping items, such as rollups and cubes, the resulting flattened grouping sets can contain duplicate items. The standard provides for this by allowing GROUP BY DISTINCT to deduplicate them prior to doing the actual work. For example: GROUP BY ROLLUP (a,b), ROLLUP (a,c