Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p7JOl-0000Rl-HY for pgsql-hackers@arkaria.postgresql.org; Mon, 19 Dec 2022 16:53:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1p7JOj-0002JW-Fj for pgsql-hackers@arkaria.postgresql.org; Mon, 19 Dec 2022 16:53:53 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p7JOj-0002JN-70 for pgsql-hackers@lists.postgresql.org; Mon, 19 Dec 2022 16:53:53 +0000 Received: from relay5-d.mail.gandi.net ([2001:4b98:dc4:8::225]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p7JOg-000111-4m for pgsql-hackers@postgresql.org; Mon, 19 Dec 2022 16:53:51 +0000 Received: (Authenticated sender: vik@postgresfriends.org) by mail.gandi.net (Postfix) with ESMTPSA id 046301C0002; Mon, 19 Dec 2022 16:53:46 +0000 (UTC) Message-ID: <86a93a08-8056-9c9c-7311-019b08458450@postgresfriends.org> Date: Mon, 19 Dec 2022 17:53:46 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: GROUP BY ALL To: Andrey Borodin , pgsql-hackers References: From: Vik Fearing Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 12/19/22 05:19, Andrey Borodin wrote: > Hi hackers! > > I saw a thread in a social network[0] about GROUP BY ALL. The idea seems useful. > I always was writing something like > select datname, usename, count(*) from pg_stat_activity group by 1,2; > and then rewriting to > select datname, usename, query, count(*) from pg_stat_activity group by 1,2; > and then "aaahhhh, add a number at the end". > > With the proposed feature I can write just > select datname, usename, count(*) from pg_stat_activity group by all; We already have GROUP BY ALL, but it doesn't do this. > PFA very dummy implementation just for a discussion. I think we can > add all non-aggregating targets. > > What do you think? I think this is a pretty terrible idea. If we want that kind of behavior, we should just allow the GROUP BY to be omitted since without grouping sets, it is kind of redundant anyway. I don't know what my opinion is on that. -- Vik Fearing