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 1tVop0-00BiTe-6V for pgsql-hackers@arkaria.postgresql.org; Thu, 09 Jan 2025 09:27:22 +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 1tVooz-00G1EX-4r for pgsql-hackers@arkaria.postgresql.org; Thu, 09 Jan 2025 09:27:20 +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 1tVooy-00G1EP-Qj for pgsql-hackers@lists.postgresql.org; Thu, 09 Jan 2025 09:27:20 +0000 Received: from mail-yb1-xb31.google.com ([2607:f8b0:4864:20::b31]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tVoow-000gOq-1L for pgsql-hackers@postgresql.org; Thu, 09 Jan 2025 09:27:19 +0000 Received: by mail-yb1-xb31.google.com with SMTP id 3f1490d57ef6-e46ebe19489so899924276.2 for ; Thu, 09 Jan 2025 01:27:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736414837; x=1737019637; 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=jc30EEQnBTrBBbpF0o5jIY8AEzJqjqrA4a1Pdt0cJms=; b=OpsPpxLV9gdz7cbx/Wr4c+Dp2etTiAZqb6VqEiPVcJMpjNzOgU5G6UEQM76xAVd8+G HaUUuCEErXxvjq01FQG8n50DIj7xepmiCV2Iw/DewYlBorrGfidqDuJvqnM0K8Zuma/2 ePlFPd89fanWVUtUE6HVfaUx6ofEUHebWq0wnxARunZBq0VVUI3z3KqF/0WF6/dxa/kG Rw5lcNcdbyiJ+wMcdzR8nFtLvOQ6ACIpcies4EuPCGywROAPivA/c/JZxsEyUtfTirvg FGKS2AHoA/zEVcYZI8mDDQ8m7otfwlMnkYoUdVfuomtucsAWXsuBgkL+wv4lprCa/vqt qdRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736414837; x=1737019637; 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=jc30EEQnBTrBBbpF0o5jIY8AEzJqjqrA4a1Pdt0cJms=; b=hU7ReIYDU7/oHXXdQ9rI/7DtuZyNdcCPyQdG3fRj+CEhs0MtvCDHSUTpmptNKblDtC MFlvdPkHWDSzNo54bto3nfMZPrNg13pkRYRrvFbU5Kj9H36CeSX4LB7X9ZSYgdYOT/En Dx4NakIXSzrWEyGK7FVETCwLt09AFUA0Ik+wdYU5cBbQmG2qz9kb8CHudojjwedOnwpy GpmR8MBI6bz0vU86ocPLKu2ryHliqda+t+DXGSUBIam3Uj/mNuPq6i39vDFer8owqtBC wbtK+ObavJDdL27jzSE/eN3Y6TpN0rxW0Kgb/cqeCm0kpD70h4s9vXc/wvV3noFN6WP0 N3+g== X-Forwarded-Encrypted: i=1; AJvYcCWnyGyMnV7j5bkFAeWKroSxA9DSPLrbH0ZMIMedj2dgaRRtJ5x55OgZSrXMJMYcbS+OI75qWNTqqnux+xzh@postgresql.org X-Gm-Message-State: AOJu0Yy3WphBw3cZDTZy2mlteJB5IcfHIQrDh9/HFDRPmpTPu7jl2/WN e06T2Ov0IKGkUVka11DlNrtd4VPl+mgnsZULjWKnY1jTNfQ9m6LcKpS2CqdastMrqJBawMIC8P1 4IVipO0bJI8HSaLPHB+oKwW4cgrk= X-Gm-Gg: ASbGncvPwaTE9aubM3Zv8SwSsE3uOR/VRd+Oc8KFLx8KxeGlw+GiAoHQlUyZap1L/Tv nldJbn0GZnEhveondA8WcEdsbxAYwTx3sXgKas5nXbzCO1LXxNx1ndu14yndBy4BhUd4hSJZr X-Google-Smtp-Source: AGHT+IG3jURjI3vcyg/09hzbY3NlVSLMNNWIH2uG/XPIIHN0Ohp+fMLKjyFVlvu0cOZQ+InsAV/8Ln3jWmrubmSqLlw= X-Received: by 2002:a25:2108:0:b0:e47:f4e3:8802 with SMTP id 3f1490d57ef6-e54ee15ca9dmr3890276276.12.1736414837467; Thu, 09 Jan 2025 01:27:17 -0800 (PST) MIME-Version: 1.0 References: <87il22cj51.fsf@163.com> In-Reply-To: From: Richard Guo Date: Thu, 9 Jan 2025 18:27:06 +0900 X-Gm-Features: AbW1kvYw2NhUxgXhPoShJo7Zo3YbjYl-olYKRdRm1A8Ma2O9IZz21aZt5VqDwSQ Message-ID: Subject: Re: Eager aggregation, take 3 To: jian he Cc: Robert Haas , 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 Thu, Jan 9, 2025 at 12:15=E2=80=AFPM jian he wrote: > hi. > in create_grouping_expr_infos > > tce =3D lookup_type_cache(exprType((Node *) tle->expr), > TYPECACHE_BTREE_OPFAMILY); > if (!OidIsValid(tce->btree_opf) || > !OidIsValid(tce->btree_opintype)) > return; > .... > /* > * Get the operator in the btree's opfamily. > */ > eq_op =3D get_opfamily_member(tce->btree_opf, > tce->btree_opintype, > tce->btree_opintype, > BTEqualStrategyNumber); > if (!OidIsValid(eq_op)) > return; > eq_opfamilies =3D get_mergejoin_opfamilies(eq_op); > if (!eq_opfamilies) > return; > btree_opfamily =3D linitial_oid(eq_opfamilies); > > > If eq_op is valid, then we don't need to call get_mergejoin_opfamilies? > since get_mergejoin_opfamilies output will be the same as tce->btree_opf. > and we already checked (tce->btree_opf) is valid. > > In other words, I think eq_op is valid imply > that tce->btree_opf is the value (btree opfamily) we need. Nice catch! Actually, we can use tce->btree_opf directly, without needing to check its equality operator, since we know it's a btree opfamily and it's valid. If it were a different opfamily (such as a hash opfamily), we would need to look up its equality operator, and select some btree opfamily that that operator is part of. But in this case, that's not necessary. Thanks Richard