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 1t6goH-00EqYS-FF for pgsql-hackers@arkaria.postgresql.org; Fri, 01 Nov 2024 01:50: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 1t6goF-0085ce-PV for pgsql-hackers@arkaria.postgresql.org; Fri, 01 Nov 2024 01:50:44 +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 1t6goF-0085cV-Fp for pgsql-hackers@lists.postgresql.org; Fri, 01 Nov 2024 01:50:43 +0000 Received: from mail-yw1-x112e.google.com ([2607:f8b0:4864:20::112e]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1t6go9-003sf6-7e for pgsql-hackers@lists.postgresql.org; Fri, 01 Nov 2024 01:50:42 +0000 Received: by mail-yw1-x112e.google.com with SMTP id 00721157ae682-6ea15a72087so12666247b3.1 for ; Thu, 31 Oct 2024 18:50:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1730425836; x=1731030636; darn=lists.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=0ZyJiTyFdWyvblCBNLiMtgyYW1xbqzBWMMCT2EQBtLc=; b=gsXlACd2ZkGzBcwIg3Esgk6MpZKKcWtuUlUAdqXj7PFYQ7IyGg8miP7QIX3XdK2WHH M8rNTIyGzzEmwOyzDyAbxjZ+W3mtubGA3aS6tuDOwUSw7fFPXHGCwcUBcGLVBE78ZKKU WTdGJVLkPmBAE+ZrIj+dqBCA+IMS3gCeHZpGLZFxgWODEYwUIAqRwjfrt+QpkPsPI1G5 +3LXvVuJ80CHkq+bXnt5XOXSxv5YAkSYYfICaF/ztGxZ55wE2af6D9DE7S3YLQBVjfA4 XSO7Tzgy+44s4mXfjqPQ4AuAlI4sEeJZ8q9AUIMxNMIELpBJtE5+pNe/aGIZvKwFF3V4 KyTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730425836; x=1731030636; 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=0ZyJiTyFdWyvblCBNLiMtgyYW1xbqzBWMMCT2EQBtLc=; b=vEZibfZL/8fJW+OoxREsBybyqiSI8Oy31oeosN8HRPEOTSITTBF1nWTuzJTMFx0Ybz VfI+XzYSKN4HXsZTKqoIGIMLBBieLYyMy8C9YtfExUwHWjNMRBoMHr8S8Hr058hmXvrM tkDhi3ZzZdrJYQiyPlbdayCpah7MRj4cPbf2tiKHOGRZQcQI1mDcf/LCwBxYnuE1JJJS DLhlqUE84vM/F31VCpHHTXCXPrmi43lrLizkGkzv55gaWa14C6uCWg5ZYtjPfbxFXc2P L8DmFyCf+sGYm/b+qcyHBDL9BbA9YeUkqe4SkSpwaysRux4HwMJGQJCW/nYpMxJRWS0I 5/8w== X-Forwarded-Encrypted: i=1; AJvYcCWWYr/hW8+b/7x4nDpxVm+dni3/UbcUWCtMYwbOYmKa0or8A/874sGVq/kvP3CVsG5CpRK4LVc4QUwfERj0@lists.postgresql.org X-Gm-Message-State: AOJu0YwSJZbQ9aLcvJNahjq3Rdb3EMHerYcOWDR25Tqw6uq38JlZGjNX JHtGNy2X6PRQ6VEMiWQrM/gAHL/6rYAJxxRMX9zb4zmEx0bgLmesvsTMrLnUoj/yOuFdpT/j3i+ kPvy+zgjyx+kILmP/DVdcQZO761k= X-Google-Smtp-Source: AGHT+IHQa4BCIxp6s6YU59GYTzMk44lk79giWI/vdsA3jqMLb0sljys42N1Ku2R0kkNFivtSHnNa2v6nicSWiqUpZmQ= X-Received: by 2002:a05:690c:6e8e:b0:6e3:8ecc:bb0e with SMTP id 00721157ae682-6ea52357ef1mr63045537b3.11.1730425836206; Thu, 31 Oct 2024 18:50:36 -0700 (PDT) MIME-Version: 1.0 References: <87il22cj51.fsf@163.com> In-Reply-To: From: Richard Guo Date: Fri, 1 Nov 2024 10:50:24 +0900 Message-ID: Subject: Re: Eager aggregation, take 3 To: Robert Haas 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 Tue, Oct 29, 2024 at 9:59=E2=80=AFPM Robert Haas = wrote: > 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, i= f possible. > > > The comments may be changed to "Build a grouped base relation for eac= h 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". Thank you for the suggestion. The new wording looks much better grammatically. It seems to me that we should address the nearby comment too, which goes like "consider_parallel flags for each base rel", as each rel has only one consider_parallel flag. > > > 2. According to the comments of generate_grouped_paths(), we may gen= erate paths for a grouped > > > relation on top of paths of join relation. So the =E2=80=9Drel_plain"= argument in generate_grouped_paths() may be > > > confused. "plain" usually means "base rel" . How about Re-naming rel_= plain 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. Agreed. Thanks Richard