Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kkYky-0003v2-Va for pgsql-bugs@arkaria.postgresql.org; Wed, 02 Dec 2020 20:29:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kkYkx-0006rV-IN for pgsql-bugs@arkaria.postgresql.org; Wed, 02 Dec 2020 20:29:43 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kkYkx-0006rO-CV for pgsql-bugs@lists.postgresql.org; Wed, 02 Dec 2020 20:29:43 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kkYkv-0004y9-9O for pgsql-bugs@lists.postgresql.org; Wed, 02 Dec 2020 20:29:42 +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 0B2KTd2E1672658; Wed, 2 Dec 2020 15:29:39 -0500 From: Tom Lane To: bertrand.guillaumin@gmail.com cc: pgsql-bugs@lists.postgresql.org Subject: Re: BUG #16759: Estimation of the planner is wrong for hash join In-reply-to: <16759-f0980add03d8f152@postgresql.org> References: <16759-f0980add03d8f152@postgresql.org> Comments: In-reply-to PG Bug reporting form message dated "Wed, 02 Dec 2020 10:43:50 +0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1672656.1606940979.1@sss.pgh.pa.us> Date: Wed, 02 Dec 2020 15:29:39 -0500 Message-ID: <1672657.1606940979@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk PG Bug reporting form writes: > The following query estimated number of lines returned is 1 while it should > be around 67 or more : > explain analyze select * from enterprise where parent_enterprise in (select > enterprise_id from enterprise par where global_attribute15 = 'BEL'); I failed to reproduce this result, which is unsurprising given the lack of context. Can you provide a self-contained example? I think that highly accurate estimates are unlikely in this situation, but it is odd that "parent_enterprise in (select...)" is estimating fewer rows than "parent_enterprise = something". regards, tom lane