Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fTTQJ-0005ai-Vt for pgsql-hackers@arkaria.postgresql.org; Thu, 14 Jun 2018 14:40:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fTTQI-0007h0-6u for pgsql-hackers@arkaria.postgresql.org; Thu, 14 Jun 2018 14:40:26 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fTTQH-0007gj-WD for pgsql-hackers@lists.postgresql.org; Thu, 14 Jun 2018 14:40:26 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fTTQE-0007rv-On for pgsql-hackers@lists.postgresql.org; Thu, 14 Jun 2018 14:40:25 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id w5EEeBee027100; Thu, 14 Jun 2018 10:40:11 -0400 From: Tom Lane To: Robert Haas cc: David Rowley , Amit Langote , Dmitry Dolgov <9erthalion6@gmail.com>, Jeff Janes , Ashutosh Bapat , Pavel Stehule , PostgreSQL Hackers Subject: Re: why partition pruning doesn't work? In-reply-to: References: <22805.1528386192@sss.pgh.pa.us> <21787.1528428171@sss.pgh.pa.us> <17850.1528755844@sss.pgh.pa.us> <19365.1528820758@sss.pgh.pa.us> <30981.1528822481@sss.pgh.pa.us> <637.1528863347@sss.pgh.pa.us> <28597.1528900759@sss.pgh.pa.us> Comments: In-reply-to Robert Haas message dated "Thu, 14 Jun 2018 08:40:13 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <27098.1528987211.1@sss.pgh.pa.us> Date: Thu, 14 Jun 2018 10:40:11 -0400 Message-ID: <27099.1528987211@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Robert Haas writes: > On Thu, Jun 14, 2018 at 7:23 AM, David Rowley > wrote: >> However, I only spent about 10 mins looking into this, there may be >> some giant holes in the idea. It would need much more research. > It kind of flies in the face of the idea that a RangeTblEntry is just > a node that can be freely copied around, serialized and deserialized, > etc. And also the idea that the Plan tree is read-only to the executor, which is not a good property to give up. > I think it would be better to keep the pointer in the RelOptInfo in > the planner and in the EState or PlanState in the executor. Those are > things we don't think can be copied, serialized, etc. Yeah, RelOptInfo seems like the natural place in the planner; we might need index relcache links in IndexOptInfo, too. I'm less sure what to do in the executor. We already do keep open relation pointers in PlanStates; the problem is just that it's node-type-specific (ss_currentRelation, iss_RelationDesc, etc). Perhaps that's unavoidable and we should just add more such fields as needed. regards, tom lane