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 1t5lox-008LxX-LG for pgsql-hackers@arkaria.postgresql.org; Tue, 29 Oct 2024 12:59:39 +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 1t5low-00GHBJ-17 for pgsql-hackers@arkaria.postgresql.org; Tue, 29 Oct 2024 12:59:38 +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 1t5lov-00GHBA-NM for pgsql-hackers@lists.postgresql.org; Tue, 29 Oct 2024 12:59:38 +0000 Received: from mail-ej1-x631.google.com ([2a00:1450:4864:20::631]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1t5lot-003S5X-Bk for pgsql-hackers@postgresql.org; Tue, 29 Oct 2024 12:59:36 +0000 Received: by mail-ej1-x631.google.com with SMTP id a640c23a62f3a-a9a26a5d6bfso832463066b.1 for ; Tue, 29 Oct 2024 05:59:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730206774; x=1730811574; darn=postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=gQoQA1El2aC1T54kaL+vf1PiRaTV3ga7kJXWK3ErPhw=; b=YVe1AD4kyea0Tit3/70JTolFr7kldKnAXZZTgePbLvoCPUWB6OUbkYzQMSzIH75sb8 SEUG0IPyHdo/UGd7OZHc+6/1fIgOK/7f2YnfXno/HKwKtc/ejWluQ4upGyDfxN+X7mNJ mOvqZTVQ7xCoPYmBZiABN3qZBO6VrxhrK6CDLGL0A5C+nCYWeiX8oge4SrxZF5qB6xRP uNoZF3ukpyu+H1C6Ebw1K3XgLC7mRmyBI6aWNDzioBidqRlpStzJEWGSKVUmWIDR2ISq eXlzgafX2SKZfFRGISQ2x74J3BVnIt5nSqyfeRbczHa3WBU2N//qHII76OhneM5BNhVk 5QtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730206774; x=1730811574; h=content-transfer-encoding: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=gQoQA1El2aC1T54kaL+vf1PiRaTV3ga7kJXWK3ErPhw=; b=PGd92LmCHx6Be9eTnw22OdwxvQh8Gn2pv2DuNsIxl9kBMl/8YT8f1JhpOhQ/8pupn/ 9jWVdDdg0WHx69f0pxB/nt14MWdM+6mAU+jA+7j7h6hr9NEmOzZkRXT/D2su7H1doLJc dCCpq+ii1FniHDerH3s5X1RK8tlgABnjB+X2PbTqAdS9pkRAdk9zB3QR98RcZmM/3kZH 6ad4fsVl1bhgYCPBG7tQoZTl/KBcVJNaJRDDrj80bqcdbzNn5pVT/C7AYXx2yZQ3I3wU 0u19djsjyQjPRi/V19ahhF25xiUHf7RmfDIsOR+gu4oFoRN8855lSwnkH3vDolUXTtNg VvSw== X-Forwarded-Encrypted: i=1; AJvYcCUZhrRpFw5EzyA95dJRQ7DTJF0447gDGrENh0SLIxJ17C8XBcEtc/5eaTiI9eyX2eyg6mY538O+DyCQBMq7@postgresql.org X-Gm-Message-State: AOJu0Ywz353KRrVKI7gjGHrDEclWJKOv9VFcohK9R5sIHZTvuiomL8il cPv4JjtnDxTef60TJPhRaWUEXs1nda5cwk2bE/lk34p0MQIAopvDf1AAFQQ2GyU0rDoqOhqxRX5 1cStuBR4zC859Bg0e7XYSbfaBox3K3HZp X-Google-Smtp-Source: AGHT+IEj6jQGEE73bQxH/4F+L8w8lbAxvjDLf0rteSvL916Wgtn1PGD612jTkazyGwuHqlvoYLXVl9/aMSp9CIXQUos= X-Received: by 2002:a17:907:d2a:b0:a99:87ea:de57 with SMTP id a640c23a62f3a-a9de5ca5ec8mr952111866b.2.1730206773440; Tue, 29 Oct 2024 05:59:33 -0700 (PDT) MIME-Version: 1.0 References: <87il22cj51.fsf@163.com> In-Reply-To: From: Robert Haas Date: Tue, 29 Oct 2024 08:59:21 -0400 Message-ID: Subject: Re: Eager aggregation, take 3 To: Richard Guo Cc: Tender Wang , Paul George , Andy Fan , PostgreSQL-development , pgsql-hackers@lists.postgresql.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, Sep 25, 2024 at 3:03=E2=80=AFAM Richard Guo wrote: > On Wed, Sep 11, 2024 at 10:52=E2=80=AFAM Tender Wang = wrote: > > 1. In make_one_rel(), we have the below codes: > > /* > > * Build grouped base relations for each base rel if possible. > > */ > > setup_base_grouped_rels(root); > > > > As far as I know, each base rel only has one grouped base relation, if = possible. > > The comments may be changed to "Build a grouped base relation for each = base rel if possible." > > Yeah, each base rel has only one grouped rel. However, there is a > comment nearby stating 'consider_parallel flags for each base rel', > which confuses me about whether it should be singular or plural in > this context. Perhaps someone more proficient in English could > clarify this. It's not confusing the way you have it, but I think an English teacher wouldn't like it, because part of the sentence is singular ("each base rel") and the other part is plural ("grouped base relations"). Tender's proposed rewrite fixes that. Another way to fix it is to write "Build group relations for base rels where possible". > > 2. According to the comments of generate_grouped_paths(), we may gener= ate paths for a grouped > > relation on top of paths of join relation. So the =E2=80=9Drel_plain" a= rgument in generate_grouped_paths() may be > > confused. "plain" usually means "base rel" . How about Re-naming rel_pl= ain to input_rel? > > I don't think 'plain relation' necessarily means 'base relation'. In > this context I think it can mean 'non-grouped relation'. But maybe > I'm wrong. We use the term "plain relation" in several different ways. In the header comments for addFkRecurseReferenced, it means a non-partitioned relation. In the struct comments for RangeTblEntry, it means any sort of named thing in pg_class that you can scan, so either a partitioned or unpartitioned table but not a join or a table function or something. AFAICT, the most common meaning of "plain relation" is a pg_class entry where relkind=3D=3DRELKIND_RELATION. --=20 Robert Haas EDB: http://www.enterprisedb.com