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 1kXojh-0004bw-86 for pgsql-performance@arkaria.postgresql.org; Wed, 28 Oct 2020 16:55:45 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kXoje-00029w-TZ for pgsql-performance@arkaria.postgresql.org; Wed, 28 Oct 2020 16:55:42 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kXoje-00029p-MP for pgsql-performance@lists.postgresql.org; Wed, 28 Oct 2020 16:55:42 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kXojV-0003Rp-8o for pgsql-performance@lists.postgresql.org; Wed, 28 Oct 2020 16:55:39 +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 09SGtQZb1345772; Wed, 28 Oct 2020 12:55:26 -0400 From: Tom Lane To: "Ehrenreich, Sigrid" cc: David Rowley , "pgsql-performance@lists.postgresql.org" Subject: Re: Postgres Optimizer ignores information about foreign key relationship, severly misestimating number of returned rows in join In-reply-to: References: <807004.1603752841@sss.pgh.pa.us> Comments: In-reply-to "Ehrenreich, Sigrid" message dated "Tue, 27 Oct 2020 07:50:19 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1345770.1603904126.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Wed, 28 Oct 2020 12:55:26 -0400 Message-ID: <1345771.1603904126@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk "Ehrenreich, Sigrid" writes: > A patch would be very much appreciated. > We are currently running on Version 12, but could upgrade to 13, if nece= ssary. > Could you send me a notification if you managed to program a patch for t= hat? I've pushed a patch for this to HEAD, but current thinking is that we will not be back-patching it. Still, if you're desperate you could consider running a custom build of v13 with that patch --- a quick check suggests that it would back-patch easily. v12 would be a slightly harder lift (I see one hunk doesn't apply) but probably not by much. https://git.postgresql.org/gitweb/?p=3Dpostgresql.git;a=3Dpatch;h=3Dad1c36= b0709e47cdb3cc4abd6c939fe64279b63f regards, tom lane