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 1sj9oI-00Ft5j-By for pgsql-hackers@arkaria.postgresql.org; Wed, 28 Aug 2024 03:57:30 +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 1sj9oG-00GZBx-BA for pgsql-hackers@arkaria.postgresql.org; Wed, 28 Aug 2024 03:57:28 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sj9oF-00GZBo-Vr for pgsql-hackers@lists.postgresql.org; Wed, 28 Aug 2024 03:57:28 +0000 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sj9oC-001rKC-Fd for pgsql-hackers@postgresql.org; Wed, 28 Aug 2024 03:57:27 +0000 Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-42819654737so52950535e9.1 for ; Tue, 27 Aug 2024 20:57:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724817444; x=1725422244; darn=postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=dnw/IvCqSGhKECLqliV3hTiowWgoIqT3VmuyY76JcDo=; b=UCQZsx6C8Fsvk4GGca0lWNKlXzo8iNXuPDOmAFtlBV7sw0zmuhvjHkZ1i5LF5bWN24 ptsBWJ1J19ii0IcKm4d3fY2ss2a2DCrtz6u/8+Cb3oYfmX9pNGQuLSTkrKoAGLgIwN8c 2XG96tPm2qseaqHC067kY9hcgsWdoY2PAyqGPCxkoffCWJZCnPRN1eOeF43r8xXoaoEM nyFZtR/cZYKP0OH3N+gbmcu6CaqCb6XSrG8xiYCgJQQxmwjjO3vz2gqv6T3isDsCdvN5 /vJBKKmYkihmICJ8iqDpVeGC35+u5yi3h4fXA4yzDBuwXD5ATQ1JPK7jaZnFhalSko7B xW6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724817444; x=1725422244; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=dnw/IvCqSGhKECLqliV3hTiowWgoIqT3VmuyY76JcDo=; b=q8ZaufPW0yyMpdK9NBQsfYUgUZb77iX07otXwwUr1DshlHSuXUsVc8nrXpR/eL32/A 7bCzXgqJch5AwOm05j7x4g20znENNGaGi+8vvZR1U/URrZrokbZcUYQn7r+opnno5UOp vBBQATMxwBbWfC0DQEPOGapj/zGlX7Z/+mLWHzibBcmJP0TcE60e7FjRld5CbTc+VfPm W8B5/tFGZJxbM5pb7aMBNe2/w26KtVQlw3/xN8XjmQOotmtLVQp+Yr80J5aQmgVOVVMu YsY89CiULXTDL1OJgrkdRfVu9DzSbp3MO2WZZ/uqOGaVBjECNUyWhngSs+TiSjRwSrPB V33g== X-Forwarded-Encrypted: i=1; AJvYcCUsbwUiOTcrruf1bfa9SizbRn9BTE6qv0+HtUQ0O9qRK68oqts9Bpum8vRbVo1h0MwjPeF6wqwhjjS7d4kR@postgresql.org X-Gm-Message-State: AOJu0YwZWeg3kZo6CRsIkkC4owB0rLT17Ahlrq9YBGlG+f0nz8EJLWUI thNt0bhot+g6pR8ZT9uSlVi/pfhJW+uLjwNxr/13hbMC8BtV1jKloW9b/DslnBOwKzefRB2NXNq b85WGmEzHJYGIKlRYTds8wB6U4IM= X-Google-Smtp-Source: AGHT+IECor2tkHX7zw7CFcYe8UBN19YTTNRC2XVBEuyG2sxT0Frc0rp1FG2V+s/8Ik6neFze/GTiknjysvKloRjfL64= X-Received: by 2002:adf:fe09:0:b0:368:327c:372b with SMTP id ffacd0b85a97d-37311858570mr8968615f8f.19.1724817443943; Tue, 27 Aug 2024 20:57:23 -0700 (PDT) MIME-Version: 1.0 References: <87il22cj51.fsf@163.com> In-Reply-To: From: Tender Wang Date: Wed, 28 Aug 2024 11:57:12 +0800 Message-ID: Subject: Re: Eager aggregation, take 3 To: Richard Guo Cc: Paul George , Andy Fan , PostgreSQL-development , pgsql-hackers@lists.postgresql.org, Robert Haas Content-Type: multipart/alternative; boundary="0000000000000c83150620b65b31" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000000c83150620b65b31 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Richard Guo =E4=BA=8E2024=E5=B9=B48=E6=9C=8821=E6= =97=A5=E5=91=A8=E4=B8=89 15:11=E5=86=99=E9=81=93=EF=BC=9A > On Fri, Aug 16, 2024 at 4:14=E2=80=AFPM Richard Guo > wrote: > > I had a self-review of this patchset and made some refactoring, > > especially to the function that creates the RelAggInfo structure for a > > given relation. While there were no major changes, the code should > > now be simpler. > > I found a bug in v10 patchset: when we generate the GROUP BY clauses > for the partial aggregation that is pushed down to a non-aggregated > relation, we may produce a clause with a tleSortGroupRef that > duplicates one already present in the query's groupClause, which would > cause problems. > > Attached is the updated version of the patchset that fixes this bug > and includes further code refactoring. > Rectenly, I do some benchmark tests, mainly on tpch and tpcds. tpch tests have no plan diff, so I do not continue to test on tpch. tpcds(10GB) tests have 22 plan diff as below: 4.sql, 5.sql, 8.sql,11.sql,19.sql,23.sql,31.sql, 33.sql,39.sql,45.sql,46.sql,47.sql,53.sql, 56.sql,57.sql,60.sql,63.sql,68.sql,74.sql,77.sql,80.sql,89.sql I haven't look all of them. I just pick few simple plan test(e.g. 19.sql, 45.sql). For example, 19.sql, eager agg pushdown doesn't get large gain, but a littl= e performance regress. I will continue to do benchmark on this feature. [1] https://github.com/tenderwg/eager_agg --=20 Tender Wang --0000000000000c83150620b65b31 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
Richard Guo <guofenglinux@gmail.com> =E4=BA=8E2024=E5=B9=B48= =E6=9C=8821=E6=97=A5=E5=91=A8=E4=B8=89 15:11=E5=86=99=E9=81=93=EF=BC=9A
=
On Fri, Aug 16, 202= 4 at 4:14=E2=80=AFPM Richard Guo <guofenglinux@gmail.com> wrote:
> I had a self-review of this patchset and made some refactoring,
> especially to the function that creates the RelAggInfo structure for a=
> given relation.=C2=A0 While there were no major changes, the code shou= ld
> now be simpler.

I found a bug in v10 patchset: when we generate the GROUP BY clauses
for the partial aggregation that is pushed down to a non-aggregated
relation, we may produce a clause with a tleSortGroupRef that
duplicates one already present in the query's groupClause, which would<= br> cause problems.

Attached is the updated version of the patchset that fixes this bug
and includes further code refactoring.

= Rectenly, I do some benchmark tests, mainly on tpch and tpcds.
tp= ch tests have no plan diff, so I do not continue to test on tpch.
tpcds(10GB) tests have 22 plan diff as below:
4.sql, 5.sql, 8.sq= l,11.sql,19.sql,23.sql,31.sql, 33.sql,39.sql,45.sql,46.sql,47.sql,53.sql,
56.sql,57.sql,60.sql,63.sql,68.sql,74.sql,77.sql,80.sql,89.sql

I haven't look all of them. I just pick few simpl= e plan test(e.g. 19.sql, 45.sql).
For example, 19.sql, eager agg = pushdown doesn't get large gain, but a little
performance reg= ress.

I will continue to do benchmark on this feat= ure.

--
Tender Wang
--0000000000000c83150620b65b31--