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 1htBrF-0003CF-Iq for pgsql-hackers@arkaria.postgresql.org; Thu, 01 Aug 2019 14:15:05 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1htBrE-0002zG-48 for pgsql-hackers@arkaria.postgresql.org; Thu, 01 Aug 2019 14:15:04 +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 1htBrD-0002yz-Q9 for pgsql-hackers@lists.postgresql.org; Thu, 01 Aug 2019 14:15:03 +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 1htBrB-0001oL-Nu for pgsql-hackers@lists.postgresql.org; Thu, 01 Aug 2019 14:15:03 +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 x71EEssQ005929; Thu, 1 Aug 2019 10:14:54 -0400 From: Tom Lane To: Richard Guo cc: Arne Roland , "pgsql-hackers@lists.postgresql.org" Subject: Re: Partial join In-reply-to: References: <9dc03e949e9b4327a0d074da9ab44318@index.de> Comments: In-reply-to Richard Guo message dated "Thu, 01 Aug 2019 19:14:44 +0800" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <5927.1564668894.1@sss.pgh.pa.us> Date: Thu, 01 Aug 2019 10:14:54 -0400 Message-ID: <5928.1564668894@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Richard Guo writes: > For the third query, a rough investigation shows that, the qual 'sl = > 5' and 'sc.sl = sg.sl' will form an equivalence class and generate two > implied equalities: 'sc.sl = 5' and 'sg.sl = 5', which can be pushed > down to the base rels. One consequence of the deduction is when > constructing restrict lists for the joinrel, we lose the original > restrict 'sc.sl = sg.sl', and this would fail the check > have_partkey_equi_join(), which checks if there exists an equi-join > condition for each pair of partition keys. As a result, this joinrel > would not be considered as an input to further partitionwise joins. > We need to fix this. Uh ... why? The pushed-down restrictions should result in pruning away any prunable partitions at the scan level, leaving nothing for the partitionwise join code to do. regards, tom lane