Re: GROUPING - Mailing list pgsql-hackers

From Dean Rasheed
Subject Re: GROUPING
Date
Msg-id CAEZATCUYmq3R74Ztkjvs1rC5LfN3juVyUNAM+t0f8KWeEuvMeA@mail.gmail.com
Whole thread Raw
In response to Re: GROUPING  (Andrew Gierth <andrew@tao11.riddles.org.uk>)
Responses Re: GROUPING
List pgsql-hackers
On 21 May 2015 at 09:20, Andrew Gierth <andrew@tao11.riddles.org.uk> wrote:
>>>>>> "Dean" == Dean Rasheed <dean.a.rasheed@gmail.com> writes:
>
>  >> Maybe INT8 would be a better choice than INT4?  But I'm not sure
>  >> there's any practical use-case for more than 30 grouping sets
>  >> anyway.  Keep in mind the actual output volume probably grows like
>  >> 2^N.
>
>  Dean> Actually using ROLLUP the output volume only grows linearly with
>  Dean> N. I tend to think that having such a large number of grouping
>  Dean> sets would be unlikely, however, it seems wrong to be putting an
>  Dean> arbitrary limit on it that's significantly smaller than the
>  Dean> number of columns allowed in a table.
>
> Limit on what exactly?
>
> Consider that in both MSSQL 2014 and Oracle 12 the limit on the number
> of arguments in a GROUPING() expression is ... 1.
>

Actually Oracle haven't quite followed the standard. They have 2
separate functions: GROUPING() which only allows 1 parameter, and
GROUPING_ID() which allows multiple parameters, and returns a bitmask
like our GROUPING() function. However, their GROUPING_ID() function
seems to return an arbitrary precision number and allows an arbitrary
number of parameters (well, I tested it up 70 to prove it wasn't a
64-bit number).

Regards,
Dean



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: Change pg_cancel_*() to ignore current backend
Next
From: Heikki Linnakangas
Date:
Subject: Archiving last incomplete segment as .partial issues