Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h9NCV-0000Az-6y for pgsql-hackers@arkaria.postgresql.org; Thu, 28 Mar 2019 05:03:39 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1h9NCT-0004jh-RP for pgsql-hackers@arkaria.postgresql.org; Thu, 28 Mar 2019 05:03:37 +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_SHA1:256) (Exim 4.89) (envelope-from ) id 1h9NCT-0004jW-J2 for pgsql-hackers@lists.postgresql.org; Thu, 28 Mar 2019 05:03:37 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h9NCR-0003Zo-Fs for pgsql-hackers@postgresql.org; Thu, 28 Mar 2019 05:03:37 +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 x2S53LAk019664; Thu, 28 Mar 2019 01:03:21 -0400 From: Tom Lane To: Amit Langote cc: David Rowley , Imai Yoshikazu , "jesper.pedersen@redhat.com" , "Imai, Yoshikazu" , Amit Langote , Alvaro Herrera , Robert Haas , Justin Pryzby , Pg Hackers Subject: Re: speeding up planning with partitions In-reply-to: <59737210-61bd-e583-4393-cc0a5ab52549@lab.ntt.co.jp> References: <0F97FA9ABBDBE54F91744A9B37151A512B3528@g01jpexmbkw24> <0F97FA9ABBDBE54F91744A9B37151A512B359C@g01jpexmbkw24> <72094fc9-3232-0fc7-b7cd-42e1c73d5aee@lab.ntt.co.jp> <0F97FA9ABBDBE54F91744A9B37151A512B45CD@g01jpexmbkw24> <53a80692-c68d-5e11-1014-6441b6e8ca5a@redhat.com> <20519.1553288822@sss.pgh.pa.us> <15573.1553639191@sss.pgh.pa.us> <47d2fd82-3f70-077b-abc6-863e3fa23503@lab.ntt.co.jp> <379243a6-33d5-af38-43c9-37120a0893bd@lab.ntt.co.jp> <18712.1553698656@sss.pgh.pa.us> <5! 9737210-61bd-e583-4393-cc0a5ab52549@lab.ntt.co.jp> Comments: In-reply-to Amit Langote message dated "Thu, 28 Mar 2019 13:57:13 +0900" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <19662.1553749401.1@sss.pgh.pa.us> Date: Thu, 28 Mar 2019 01:03:21 -0400 Message-ID: <19663.1553749401@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Amit Langote writes: > On 2019/03/27 23:57, Tom Lane wrote: >> Yeah, there's something to be said for having plancat.c open each table >> *and store the Relation pointer in the RelOptInfo*, and then close that >> again at the end of planning rather than immediately. If we can't avoid >> these retail table_opens without a great deal of pain, that's the >> direction I'd tend to go in. However it would add some overhead, in >> the form of a need to traverse the RelOptInfo array an additional time. > Just to be sure, do you mean we should do that now or later (David said > "in the long term")? It's probably not high priority, though I wonder how much time is being eaten by the repeated table_opens. regards, tom lane