Re: Inheriting table AMs for partitioned tables - Mailing list pgsql-hackers

From Haribabu Kommi
Subject Re: Inheriting table AMs for partitioned tables
Date
Msg-id CAJrrPGfyntGEFRTjEuZsgrKYzSxKGuEQ-Wbty0yV4iR6sVdjrQ@mail.gmail.com
Whole thread Raw
In response to Inheriting table AMs for partitioned tables  (Andres Freund <andres@anarazel.de>)
List pgsql-hackers


On Tue, Mar 5, 2019 at 10:47 AM Andres Freund <andres@anarazel.de> wrote:
Hi,

In the pluggable storage patch [1], one thing that I'm wondering about
is how exactly to inherit the storage AM across partitions. I think
that's potentially worthy of a discussion with a wider audience than I'd
get in that thread.  It seems also related to the recent discussion in [2]

Consider (excerpted from the tests):

CREATE TABLE tableam_parted_heap2 (a text, b int) PARTITION BY list (a) USING heap2;

SET default_table_access_method = 'heap';
CREATE TABLE tableam_parted_a_heap2 PARTITION OF tableam_parted_heap2 FOR VALUES IN ('a');

SET default_table_access_method = 'heap2';
CREATE TABLE tableam_parted_b_heap2 PARTITION OF tableam_parted_heap2 FOR VALUES IN ('b');

CREATE TABLE tableam_parted_c_heap2 PARTITION OF tableam_parted_heap2 FOR VALUES IN ('c') USING heap;
CREATE TABLE tableam_parted_d_heap2 PARTITION OF tableam_parted_heap2 FOR VALUES IN ('d') USING heap2;

It seems pretty clear that tableam_parted_heap2, tableam_parted_d_heap2
would be stored via heap2, and tableam_parted_c_heap2 via heap.

But for tableam_parted_a_heap2 tableam_parted_b_heap2 the answer isn't
quite as clear.  I think it'd both be sensible for new partitions to
inherit the AM from the root, but it'd also be sensible to use the
current default.

Out of laziness (it's how it works rn) I'm inclined to to go with using
the current default, but I'd be curious if others disagree.


As other said that, I also agree to go with default_table_access_method to be
preferred if not explicitly specified the access method during the table creation.

This discussion raises a point that, in case if the user wants to change the
access method of a table later once it is created, currently there is no option.
currently there are no other alternative table access methods that are available
for the user to switch, but definitely it may be required later.

I will provide a patch to alter the access method of a table for v13.

Regards,
Haribabu Kommi
Fujitsu Australia

pgsql-hackers by date:

Previous
From: Amit Langote
Date:
Subject: Re: Inheriting table AMs for partitioned tables
Next
From: Haribabu Kommi
Date:
Subject: Re: [bug fix] Produce a crash dump before main() on Windows