Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qlTmX-002zSV-Ar for pgsql-hackers@arkaria.postgresql.org; Wed, 27 Sep 2023 12:36:45 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qlTmV-003joI-VZ for pgsql-hackers@arkaria.postgresql.org; Wed, 27 Sep 2023 12:36:43 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qlTmV-003jo0-GI for pgsql-hackers@lists.postgresql.org; Wed, 27 Sep 2023 12:36:43 +0000 Received: from mail.postgrespro.ru ([93.174.131.139]) by makus.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1qlTmP-006vVA-Jr for pgsql-hackers@postgresql.org; Wed, 27 Sep 2023 12:36:42 +0000 Received: from mail.postgrespro.ru (webmail.mstn.postgrespro.ru [192.168.2.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: a.pyhalov@postgrespro.ru) by mail.postgrespro.ru (Postfix/587) with ESMTPSA id C9FEAE2102D; Wed, 27 Sep 2023 15:36:34 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mx2023; t=1695818194; bh=I9Ypah0JcxbnbNYm0N6WCCP8Ooat4QACtLXSo9178gw=; h=Date:From:To:Cc:Subject:In-Reply-To:References:User-Agent: Message-ID:From; b=hKLejeMliiqvD+FhhfmDf3kTicZeD4uVk3LcPljeI57P2fTx1v3k8G9ocsBqeTnhJ L31fd88GT1zQrkAbpf/0fgd/C6g1NCB7Ds81bfFZ4rI+VZMcoipedni6RJ6iYJecQk x72kvIUc/1O0H6so+jnZJ1S3NSUSgX4n7NN3j5BJzEGo2FeZUf/2KniNJQKG/EzEmi NP36U59OKuBKa8/MInEn6ML/3e1RO5mKB19CTHVdUgWX+kXCkBdSjb8wHz1282tCBI F1D8W6fiBT2KqI8kSbhGVLp3MBlmRgVgGKNMxuKTcSKpDPLpbmQn7d8qo3ACnnzS5J IC5jARm7FgNIw== MIME-Version: 1.0 Date: Wed, 27 Sep 2023 15:36:34 +0300 From: Alexander Pyhalov To: "Fujii.Yuki@df.MitsubishiElectric.co.jp" Cc: Bruce Momjian , PostgreSQL-development , "Finnerty, Jim" , Andres Freund , Tom Lane , Tomas Vondra , Julien Rouhaud , Daniel Gustafsson Subject: Re: Partial aggregates pushdown In-Reply-To: References: User-Agent: Roundcube Webmail/1.4.11 Message-ID: <3c97067f40503bd8ebb3659f5daa2ff5@postgrespro.ru> X-Sender: a.pyhalov@postgrespro.ru Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Fujii.Yuki@df.MitsubishiElectric.co.jp писал 2023-09-27 01:35: > Hi Mr.Momjian, Mr.Pyhalov. > > Tuesday, 26 September 2023 22:15 Alexander Pyhalov > : >> Do you mean that extra->partial_target->sortgrouprefs is not replaced, >> and so we preserve tlesortgroupref numbers? > Yes, that is correct. > >> I'm suspicious about rewriting extra->partial_target->exprs with >> partial_target->exprs - I'm still not sure why we >> don't we loose information, added by add_column_to_pathtarget() to >> extra->partial_target->exprs? >> Hi. In postgres_fdw.sql "Partial aggregates are unsafe to push down having clause when there are partial aggregates" - this comment likely should be fixed. Some comments should be added to setGroupClausePartial() and to make_partial_grouping_target() - especially why setGroupClausePartial() is called prior to add_new_columns_to_pathtarget(). I'm not sure that I like this mechanics of adding sort group clauses - it seems we do in core additional work, which is of use only for one extension, but at least it seems to be working. -- Best regards, Alexander Pyhalov, Postgres Professional