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.96) (envelope-from ) id 1va3we-00369K-1q for pgsql-hackers@arkaria.postgresql.org; Mon, 29 Dec 2025 03:29:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1va3wd-00FIBV-1m for pgsql-hackers@arkaria.postgresql.org; Mon, 29 Dec 2025 03:29:20 +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.96) (envelope-from ) id 1va3wd-00FIBM-0o for pgsql-hackers@lists.postgresql.org; Mon, 29 Dec 2025 03:29:20 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1va3wb-003Kul-2A for pgsql-hackers@lists.postgresql.org; Mon, 29 Dec 2025 03:29:19 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 5BT3TGso2742258; Sun, 28 Dec 2025 22:29:16 -0500 From: Tom Lane To: Chao Li cc: pgsql-hackers@lists.postgresql.org Subject: Re: Fixing some ancient errors in hash join costing In-reply-to: <705AC80B-8E3A-4DA2-9FC2-A05C4D6C70FD@gmail.com> References: <2380165.1766871097@sss.pgh.pa.us> <2551253.1766952956@sss.pgh.pa.us> <2712245.1766962600@sss.pgh.pa.us> <705AC80B-8E3A-4DA2-9FC2-A05C4D6C70FD@gmail.com> Comments: In-reply-to Chao Li message dated "Mon, 29 Dec 2025 08:39:38 +0800" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <2742256.1766978956.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Sun, 28 Dec 2025 22:29:16 -0500 Message-ID: <2742257.1766978956@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Chao Li writes: > Just a few small comments on v2: > This is not a concern, just curious why switch the setting order of enab= le_hashjoin and enable_sort? The need to disable hashjoin only applies to one of the two tests, so it seemed to me that this way is more nicely nested. Judgment call of course. > As flag 0 is passed to get_attstatsslot(), free_attstatsslot() is not ne= eded. True. I wrote it like that so people wouldn't wonder if I'd forgotten free_attstatsslot(), but if other call sites passing flags =3D=3D 0 don't use it then it'd be better to be consistent. (I didn't check that.) > Maybe worth adding a short comment like =E2=80=9C0.0 doesn=E2=80=99t mea= n zero frequency, instead 0.0 means no data or unknown frequency=E2=80=9D,= which might help code readers to quickly understand the logic. Doesn't the function's header comment cover that adequately? regards, tom lane