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 1r45EC-007HI9-Dv for pgsql-general@arkaria.postgresql.org; Fri, 17 Nov 2023 20:14:12 +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 1r45EB-00Fgs3-2m for pgsql-general@arkaria.postgresql.org; Fri, 17 Nov 2023 20:14:11 +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.94.2) (envelope-from ) id 1r45EA-00Fgrv-Oc for pgsql-general@lists.postgresql.org; Fri, 17 Nov 2023 20:14:10 +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.94.2) (envelope-from ) id 1r45E8-006xG0-Bw for pgsql-general@lists.postgresql.org; Fri, 17 Nov 2023 20:14:10 +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 3AHKE6fi757727; Fri, 17 Nov 2023 15:14:06 -0500 From: Tom Lane To: =?UTF-8?Q?Torsten_F=C3=B6rtsch?= cc: pgsql-general Subject: Re: query plan In-reply-to: References: Comments: In-reply-to =?UTF-8?Q?Torsten_F=C3=B6rtsch?= message dated "Fri, 17 Nov 2023 21:00:20 +0100" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <757725.1700252046.1@sss.pgh.pa.us> Date: Fri, 17 Nov 2023 15:14:06 -0500 Message-ID: <757726.1700252046@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk =?UTF-8?Q?Torsten_F=C3=B6rtsch?= writes: > This is part of a query plan: > Nested Loop Left Join (cost=26.32..47078866.36 rows=1344945195 width=626) > -> Nested Loop Left Join (cost=25.74..5312.48 rows=1344945195 > width=608) > -> Nested Loop Left Join (cost=6.79..2876.77 rows=102 width=373) > -> Nested Loop Left Join (cost=1.90..1965.51 rows=102 > width=361) > -> Bitmap Heap Scan on ... (cost=4.89..8.91 rows=2 > width=28) > -> Hash Left Join (cost=18.95..42.61 rows=3 width=243) > -> Hash Left Join (cost=18.94..42.59 rows=3 width=203) > -> Hash (cost=0.00..0.00 rows=1 width=48) > -> Memoize (cost=0.58..4.59 rows=1 width=172) > What I don't understand is this. The left node of the join is expected to > return 102 rows. The right node 3. How can this result in >1e9 rows? The rowcount estimate for the join is not derived by multiplying the rowcount estimates of the two inputs. Having said that, this looks pretty inconsistent. Can you show a test case that acts like that? regards, tom lane