Re: GROUPING

From: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
To: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, David Fetter <david(at)fetter(dot)org>, PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: GROUPING
Date: 2015-05-21 12:22:18
Message-ID: CAEZATCUYmq3R74Ztkjvs1rC5LfN3juVyUNAM+t0f8KWeEuvMeA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 21 May 2015 at 09:20, Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk> wrote:
>>>>>> "Dean" == Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2015-05-21 12:35:13 Archiving last incomplete segment as .partial issues
Previous Message Robert Haas 2015-05-21 12:12:20 Re: Change pg_cancel_*() to ignore current backend