Re: GROUPING

From: Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: David Fetter <david(at)fetter(dot)org>, PG Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: GROUPING
Date: 2015-05-21 08:08:38
Message-ID: CAEZATCXmvAiYDihc26+KejdJQ08fW1nXhgMgecLnPnXzv79j6A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 20 May 2015 at 19:41, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> David Fetter <david(at)fetter(dot)org> writes:
>> While kicking the tires on the new GROUPING() feature, I noticed that
>> NUMERIC has no cast to bit(n). GROUPING() produces essentially a
>> bitmap, although the standard mandates for some reason that it be a
>> numeric type.
>
>> I was thinking it should produce NUMERIC rather than int4 as it does
>> now in order to accommodate large numbers of columns, but the
>> usefulness of the bitmap is greatly increased if there's a simple CAST
>> to bit(n).
>
> 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.
>

Actually using ROLLUP the output volume only grows linearly with N. I
tend to think that having such a large number of grouping sets would
be unlikely, however, it seems wrong to be putting an arbitrary limit
on it that's significantly smaller than the number of columns allowed
in a table.

Regards,
Dean

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Gierth 2015-05-21 08:20:04 Re: GROUPING
Previous Message Jeff Janes 2015-05-21 06:53:38 Re: Redesigning checkpoint_segments