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 1w2gn4-000Veh-32 for pgsql-general@arkaria.postgresql.org; Wed, 18 Mar 2026 02:37:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w2gn3-006ky5-1u for pgsql-general@arkaria.postgresql.org; Wed, 18 Mar 2026 02:37:45 +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 1w2gn3-006kxw-0s for pgsql-general@lists.postgresql.org; Wed, 18 Mar 2026 02:37:45 +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.98.2) (envelope-from ) id 1w2gn0-00000000oqe-1zWh for pgsql-general@lists.postgresql.org; Wed, 18 Mar 2026 02:37:45 +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 62I2bZTE602085; Tue, 17 Mar 2026 22:37:35 -0400 From: Tom Lane To: Greg Hennessy cc: pgsql-general@lists.postgresql.org Subject: Re: help debugging an issue with selectivity In-reply-to: <8e4f0d76-9e77-4819-96f7-cbc64a9d2b5a@gmail.com> References: <8e4f0d76-9e77-4819-96f7-cbc64a9d2b5a@gmail.com> Comments: In-reply-to Greg Hennessy message dated "Tue, 17 Mar 2026 13:29:39 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <602083.1773801455.1@sss.pgh.pa.us> Content-Transfer-Encoding: 8bit Date: Tue, 17 Mar 2026 22:37:35 -0400 Message-ID: <602084.1773801455@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Greg Hennessy writes: > I am not sure if this belongs in pgsql-general or pgsql-hackers, I am > trying first in psgl-general. Doesn't matter a lot, but as Rob noted, you should not hijack an existing thread. Start your own thread, don't reply to an unrelated message. > When I actually execute this, I get output to the terminal of the form: > WARNING:  join_selectivity: operator id 16818 jointype 0 0 > WARNING:  HERE0 pgq3c_seljoin.... 5.873266e-12 > WARNING:  datum result 4438812783922730423 0.000000 > WARNING:  HERE0 pgq3c_seljoin.... 5.873266e-12 > WARNING:  join_selectivity: 0.000000 16818 jointype 0 > WARNING:  join_selectivity: s1 0.000000 > WARNING:  clause_selectivity: s1 0.000000 > where it seems to me the q3c code is returning a non zero value, but in > the guts of postgres what is found is a zero value. I don't see any discrepancy in your results, only in your choices of printf specifiers. "%f" defaults to "%.6f", that is, print only six digits after the decimal point. So a value down around 1e-12 is going to print as all zeroes. regards, tom lane