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 1hIolg-0003pA-VM for pgsql-hackers@arkaria.postgresql.org; Tue, 23 Apr 2019 06:19:01 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hIolf-0007v0-5s for pgsql-hackers@arkaria.postgresql.org; Tue, 23 Apr 2019 06:18:59 +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 1hIole-0007pt-S3 for pgsql-hackers@lists.postgresql.org; Tue, 23 Apr 2019 06:18:58 +0000 Received: from tama500.ecl.ntt.co.jp ([129.60.39.148]) by magus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hIolX-00039G-0j for pgsql-hackers@lists.postgresql.org; Tue, 23 Apr 2019 06:18:58 +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 x3N6IixQ002873; Tue, 23 Apr 2019 15:18:44 +0900 Received: from vc2.ecl.ntt.co.jp (localhost [127.0.0.1]) by vc2.ecl.ntt.co.jp (Postfix) with ESMTP id DA2EB638F76; Tue, 23 Apr 2019 15:18:44 +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 CCF5F638F4E; Tue, 23 Apr 2019 15:18:44 +0900 (JST) Received: from [127.0.0.1] (unknown [129.60.241.61]) by jcms-pop21.ecl.ntt.co.jp (Postfix) with ESMTPSA id BE36D400729; Tue, 23 Apr 2019 15:18:44 +0900 (JST) Subject: Re: pg_dump is broken for partition tablespaces References: <20190422225129.GA6126@alvherre.pgsql> <7392bda8-83d0-ab18-6482-c0f24e0b6774@lab.ntt.co.jp> From: Amit Langote Message-ID: Date: Tue, 23 Apr 2019 15:18:15 +0900 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.6.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: David Rowley Cc: Alvaro Herrera , Robert Haas , Tom Lane , PostgreSQL Hackers X-TM-AS-MML: disable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2019/04/23 14:45, David Rowley wrote: > On Tue, 23 Apr 2019 at 13:49, Amit Langote > wrote: >> >> On 2019/04/23 7:51, Alvaro Herrera wrote: >>> To me, it sounds >>> unintuitive to accept partitions that don't exactly match the order of >>> the parent table; but it's been supported all along. >> >> You might know it already, but even though column sets of two tables may >> appear identical, their TupleDescs still may not match due to dropped >> columns being different in the two tables. > > I think that's the most likely reason that the TupleDescs would differ > at all. For RANGE partitions on time series data, it's quite likely > that new partitions are periodically created to store new data. If > the partitioned table those belong to evolved over time, gaining new > columns and dropping columns that are no longer needed then some > translation work will end up being required. From my work on > 42f70cd9c, I know tuple conversion is not free, so it's pretty good > that pg_dump will remove the need for maps in this case even with the > proposed change. Maybe I'm missing something, but if you're talking about pg_dump changes proposed in the latest patch that Alvaro posted on April 18, which is to emit partitions as two steps, then I don't see how that will always improves things in terms of whether maps are needed or not (regardless of whether that's something to optimize for or not.) If partitions needed a map in the old database, this patch means that they will *continue* to need it in the new database. With HEAD, they won't, because partitions created with CREATE TABLE PARTITION OF will have the same descriptor as parent, provided the parent is also created afresh in the new database, which is true in the non-binary-upgrade mode. The current arrangement, as I mentioned in my previous email, is partly inspired from the fact that creating the parent and partition afresh in the new database will lead them to have the same TupleDesc and hence won't need maps. Thanks, Amit