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 1oT8yS-0003gO-E8 for pgsql-admin@arkaria.postgresql.org; Tue, 30 Aug 2022 21:40: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 1oT8yQ-0005bv-Kw for pgsql-admin@arkaria.postgresql.org; Tue, 30 Aug 2022 21:40:42 +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 1oT8yQ-0005bh-8I for pgsql-admin@lists.postgresql.org; Tue, 30 Aug 2022 21:40:42 +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 1oT8yN-0006Ku-PI for pgsql-admin@lists.postgresql.org; Tue, 30 Aug 2022 21:40:41 +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 27ULebOm3757071; Tue, 30 Aug 2022 17:40:37 -0400 From: Tom Lane To: Teja Jakkidi cc: Doug Reynolds , gogala.mladen@gmail.com, pgsql-admin Subject: Re: Performance issue after creating partitions In-reply-to: <6F2BE85B-F6D0-4D4C-9DEA-EEE09D97B8EF@gmail.com> References: <738BC8F9-5F1E-4E8F-8EB9-DEE6EDAA740B@gmail.com> <6F2BE85B-F6D0-4D4C-9DEA-EEE09D97B8EF@gmail.com> Comments: In-reply-to Teja Jakkidi message dated "Tue, 30 Aug 2022 14:21:50 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3757069.1661895637.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Tue, 30 Aug 2022 17:40:37 -0400 Message-ID: <3757070.1661895637@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Teja Jakkidi writes: > Anyone ever encountered the below situation as what I am noticing with p= artitions? You haven't shown us your query, so any answer would be blind speculation. However, in the spirit of blind speculation, I'm wondering if you're expecting those range constraints to propagate across a join. They won't; you'd need to duplicate the conditions for the other table. That is, if you have WHERE+JOIN/ON conditions amounting to WHERE a.a =3D b.b AND b.b =3D constant the planner is able to derive "a.a =3D constant" on the assumption of transitivity, and use that to constrain the scan of table a (ie, use an index, reject partitions at plan time, etc). But no such deduction happens for WHERE a.a =3D b.b AND b.b >=3D constant If you want a constrained scan of a, you need to write it out: WHERE a.a =3D b.b AND b.b >=3D constant AND a.a >=3D constant regards, tom lane