Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ciQSr-0008Al-Hc for pgsql-hackers@arkaria.postgresql.org; Mon, 27 Feb 2017 18:56:05 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1ciQSq-0004KP-MZ for pgsql-hackers@arkaria.postgresql.org; Mon, 27 Feb 2017 18:56:04 +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.84_2) (envelope-from ) id 1ciQRL-0001U2-5c for pgsql-hackers@postgresql.org; Mon, 27 Feb 2017 18:54:31 +0000 Received: from momjian.us ([72.94.173.45]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1ciQRI-000068-3K for pgsql-hackers@postgresql.org; Mon, 27 Feb 2017 18:54:29 +0000 Received: from bruce by momjian.us with local (Exim 4.84_2) (envelope-from ) id 1ciQRE-0007gz-Jl; Mon, 27 Feb 2017 13:54:24 -0500 Date: Mon, 27 Feb 2017 13:54:24 -0500 From: Bruce Momjian To: Amit Langote Cc: Pg Hackers Subject: Re: Partitioned tables and relfilenode Message-ID: <20170227185424.GA421@momjian.us> References: <2b0d42f2-3a53-763b-c9c2-47139e4b1c2e@lab.ntt.co.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2b0d42f2-3a53-763b-c9c2-47139e4b1c2e@lab.ntt.co.jp> User-Agent: Mutt/1.5.23 (2014-03-12) X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On Fri, Feb 10, 2017 at 03:19:47PM +0900, Amit Langote wrote: > The new partitioned tables do not contain any data by themselves. Any > data inserted into a partitioned table is routed to and stored in one of > its partitions. In fact, it is impossible to insert *any* data before a > partition (to be precise, a leaf partition) is created. It seems wasteful > then to allocate physical storage (files) for partitioned tables. If we > do not allocate the storage, then we must make sure that the right thing > happens when a command that is intended to manipulate a table's storage > encounters a partitioned table, the "right thing" here being that the > command's code either throws an error or warning (in some cases) if the > specified table is a partitioned table or ignores any partitioned tables > when it reads the list of relations to process from pg_class. Commands > that need to be taught about this are vacuum, analyze, truncate, and alter > table. Specifically: > > - In case of vacuum, specifying a partitioned table causes a warning > > - In case of analyze, we do not throw an error or warning but simply > avoid calling do_analyze_rel() *non-recursively*. Further in > acquire_inherited_sample_rows(), any partitioned tables in the list > returned by find_all_inheritors() are skipped. > > - In case of truncate, only the part which manipulates table's physical > storage is skipped for partitioned tables. > > - ATRewriteTables() skips on the AlteredTableInfo entries for partitioned > tables, because there is nothing to be done. > > - Since we cannot create indexes on partitioned tables anyway, there is > no need to handle cluster and reindex (they throw a meaningful error > already due to the lack of indexes.) I don't think we are doing this, but if the parent table doesn't have a physical file pg_upgrade will need to be taught that. We have that case now for unlogged tables on standby servers that we need to address. -- Bruce Momjian http://momjian.us EnterpriseDB http://enterprisedb.com + As you are, so once was I. As I am, so you will be. + + Ancient Roman grave inscription + -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers