Re: Partitioned tables and relfilenode

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Partitioned tables and relfilenode
Date: 2017-02-28 03:23:19
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Tue, Feb 28, 2017 at 11:53:16AM +0900, Amit Langote wrote:
> > 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.
> Partitioned tables do have physical files as of now. This thread is to
> discuss the proposal to get rid of the physical file for partitioned tables.
> By the way, I just tried pg_upgrade on top of this patch, and it seems
> partitioned tables without the physical file migrate just fine to the new
> cluster. To test I did: created a partitioned table and few partitions,
> inserted some data into it, pg_upgraded the cluster to find the
> partitioned table intact with its data in the new cluster (to be clear,
> the data is contained in partitions). Is there something that wouldn't
> work that I should instead be testing?
> Also, it seems that the partitioned tables (without physical files) won't
> have the same issue on the standby servers as unlogged tables. It's just
> that we route inserts into a partitioned table to its partitions and hence
> the partitioned table itself does not contain because all the incoming
> data is routed. Am I missing something?

I see why it works now. pg_upgrade only upgrades relations and
materialized views:

" WHERE relkind IN ('r', 'm') AND "

but partitions are defined as 'P':

#define RELKIND_PARTITIONED_TABLE 'P' /* partitioned table */

I am a little confused by the above. Is a partitioned table the parent
or the children? Reading the code it seems it is the parent, which
explains why it works. Can I clarify that?

Bruce Momjian <bruce(at)momjian(dot)us>

+ As you are, so once was I. As I am, so you will be. +
+ Ancient Roman grave inscription +

In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message Kyotaro HORIGUCHI 2017-02-28 03:27:36 Restricting maximum keep segments by repslots
Previous Message Robert Haas 2017-02-28 03:20:17 Re: Partitioned tables and relfilenode