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 1fzXhY-0002pr-SZ for pgsql-hackers@arkaria.postgresql.org; Tue, 11 Sep 2018 01:42:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fzXhV-00017C-Kt for pgsql-hackers@arkaria.postgresql.org; Tue, 11 Sep 2018 01:42:45 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fzXhV-00016d-AK for pgsql-hackers@lists.postgresql.org; Tue, 11 Sep 2018 01:42:45 +0000 Received: from tama500.ecl.ntt.co.jp ([129.60.39.148]) by makus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fzXhR-0005b6-2I for pgsql-hackers@postgresql.org; Tue, 11 Sep 2018 01:42:43 +0000 Received: from vc2.ecl.ntt.co.jp (vc2.ecl.ntt.co.jp [129.60.86.154]) by tama500.ecl.ntt.co.jp (8.13.8/8.13.8) with ESMTP id w8B1gZVe020984; Tue, 11 Sep 2018 10:42:35 +0900 Received: from vc2.ecl.ntt.co.jp (localhost [127.0.0.1]) by vc2.ecl.ntt.co.jp (Postfix) with ESMTP id E0513638465; Tue, 11 Sep 2018 10:42:35 +0900 (JST) Received: from jcms-pop21.ecl.ntt.co.jp (jcms-pop21.ecl.ntt.co.jp [129.60.87.134]) by vc2.ecl.ntt.co.jp (Postfix) with ESMTP id D52F8638427; Tue, 11 Sep 2018 10:42:35 +0900 (JST) Received: from [127.0.0.1] (unknown [129.60.241.61]) by jcms-pop21.ecl.ntt.co.jp (Postfix) with ESMTPSA id CF07B4006E1; Tue, 11 Sep 2018 10:42:35 +0900 (JST) Subject: Re: speeding up planning with partitions References: <9d7c5112-cb99-6a47-d3be-cf1ee6862a1d@lab.ntt.co.jp> From: Amit Langote Message-ID: <44463425-9eb0-3cef-eef2-0fbdb97c71dc@lab.ntt.co.jp> Date: Tue, 11 Sep 2018 10:42:15 +0900 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-CC-Mail-RelayStamp: 1 To: Peter Geoghegan Cc: Pg Hackers , Pavan Deolasee , Simon Riggs X-TM-AS-MML: disable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2018/09/11 10:11, Peter Geoghegan wrote: > On Wed, Aug 29, 2018 at 5:06 AM, Amit Langote > wrote: >> It is more or less well known that the planner doesn't perform well with >> more than a few hundred partitions even when only a handful of partitions >> are ultimately included in the plan. Situation has improved a bit in PG >> 11 where we replaced the older method of pruning partitions one-by-one >> using constraint exclusion with a much faster method that finds relevant >> partitions by using partitioning metadata. However, we could only use it >> for SELECT queries, because UPDATE/DELETE are handled by a completely >> different code path, whose structure doesn't allow it to call the new >> pruning module's functionality. Actually, not being able to use the new >> pruning is not the only problem for UPDATE/DELETE, more on which further >> below. > > This was a big problem for the SQL MERGE patch. I hope that this > problem can be fixed. Sorry if I've missed some prior discussion about this, but could you clarify which aspect of UPDATE/DELETE planning got in the way of SQL MERGE patch? It'd be great if you can point to an email or portion of the SQL MERGE discussion thread where this aspect was discussed. In the updated patch that I'm still hacking on (also need to look at David's comments earlier today before posting it), I have managed to eliminate the separation of code paths handling SELECT vs UPDATE/DELETE on inheritance tables, but I can't be sure if the new approach (also) solves any problems that were faced during SQL MERGE development. Thanks, Amit