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 1h8uWz-0006xt-H2 for pgsql-hackers@arkaria.postgresql.org; Tue, 26 Mar 2019 22:26:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1h8uWx-0000KQ-0u for pgsql-hackers@arkaria.postgresql.org; Tue, 26 Mar 2019 22:26:51 +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 1h8uWw-0000JB-Om for pgsql-hackers@lists.postgresql.org; Tue, 26 Mar 2019 22:26:50 +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 1h8uWt-0003TD-S0 for pgsql-hackers@postgresql.org; Tue, 26 Mar 2019 22:26:49 +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 x2QMQVEM015574; Tue, 26 Mar 2019 18:26:31 -0400 From: Tom Lane To: Amit Langote cc: Imai Yoshikazu , "jesper.pedersen@redhat.com" , "Imai, Yoshikazu" , "'Amit Langote'" , David Rowley , Alvaro Herrera , Robert Haas , Justin Pryzby , Pg Hackers Subject: Re: speeding up planning with partitions In-reply-to: <19f54c17-1619-b228-10e5-ca343be6a4e8@lab.ntt.co.jp> References: <0F97FA9ABBDBE54F91744A9B37151A5129DD55@g01jpexmbkw24> <256b9c87-b687-6f51-6274-19ae5743aef6@lab.ntt.co.jp> <0F97FA9ABBDBE54F91744A9B37151A5129E604@g01jpexmbkw24> <9feacaf6-ddb3-96dd-5b98-df5e927b1439@lab.ntt.co.jp> <0F97FA9ABBDBE54F91744A9B37151A512B3279@g01jpexmbkw24> <0c90ce90-b010-4791-41c0-a0df34f99ffa@lab.ntt.co.jp> <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> <19f54c17-1619-b228-10e5-ca343be6a4e8@lab! .ntt.co.jp> Comments: In-reply-to Amit Langote message dated "Mon, 25 Mar 2019 20:34:45 +0900" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <15572.1553639191.1@sss.pgh.pa.us> Date: Tue, 26 Mar 2019 18:26:31 -0400 Message-ID: <15573.1553639191@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Amit Langote writes: > On 2019/03/23 6:07, Tom Lane wrote: >> I also feel like you used a dartboard while deciding where to insert the >> call in query_planner(); dropping it into the middle of a sequence of >> equivalence-class-related operations seems quite random. Maybe we could >> delay that step all the way to just before make_one_rel, since the other >> stuff in between seems to only care about baserels? For example, >> it'd certainly be better if we could run remove_useless_joins before >> otherrel expansion, so that we needn't do otherrel expansion at all >> on a table that gets thrown away as being a useless join. > create_lateral_join_info() expects otherrels to be present to propagate > the information it creates. Sure, but the actually-useful work in that function is just concerned with baserels. The only thing it does with otherrels is to propagate parents' lateral-ref info to children, which is a lot easier, cheaper, and more reliable if we let build_simple_rel do it. See the version of 0001 I just pushed. I'll look at 0003 and up tomorrow. regards, tom lane