mirror of
https://github.com/postgres/postgres.git
synced 2025-12-21 05:21:08 +03:00
Allow specifying an access method for partitioned tables
It's now possible to specify a table access method via CREATE TABLE ... USING for a partitioned table, as well change it with ALTER TABLE ... SET ACCESS METHOD. Specifying an AM for a partitioned table lets the value be used for all future partitions created under it, closely mirroring the behavior of the TABLESPACE option for partitioned tables. Existing partitions are not modified. For a partitioned table with no AM specified, any new partitions are created with the default_table_access_method. Also add ALTER TABLE ... SET ACCESS METHOD DEFAULT, which reverts to the original state of using the default for new partitions. The relcache of partitioned tables is not changed: rd_tableam is not set, even if a partitioned table has a relam set. Author: Justin Pryzby <pryzby@telsasoft.com> Author: Soumyadeep Chakraborty <soumyadeep2007@gmail.com> Author: Michaël Paquier <michael@paquier.xyz> Reviewed-by: The authors themselves Discussion: https://postgr.es/m/CAE-ML+9zM4wJCGCBGv01k96qQ3gFv4WFcFy=zqPHKeaEFwwv6A@mail.gmail.com Discussion: https://postgr.es/m/20210308010707.GA29832%40telsasoft.com
This commit is contained in:
@@ -732,10 +732,20 @@ WITH ( MODULUS <replaceable class="parameter">numeric_literal</replaceable>, REM
|
||||
<term><literal>SET ACCESS METHOD</literal></term>
|
||||
<listitem>
|
||||
<para>
|
||||
This form changes the access method of the table by rewriting it. See
|
||||
<xref linkend="tableam"/> for more information. Writing
|
||||
<literal>DEFAULT</literal> changes the access method of the table
|
||||
to <xref linkend="guc-default-table-access-method"/>.
|
||||
This form changes the access method of the table by rewriting it
|
||||
using the indicated access method; specifying
|
||||
<literal>DEFAULT</literal> selects the access method set as the
|
||||
<xref linkend="guc-default-table-access-method"/> configuration
|
||||
parameter.
|
||||
See <xref linkend="tableam"/> for more information.
|
||||
</para>
|
||||
<para>
|
||||
When applied to a partitioned table, there is no data to rewrite,
|
||||
but partitions created afterwards will default to the given access
|
||||
method unless overridden by a <literal>USING</literal> clause.
|
||||
Specifying <varname>DEFAULT</varname> removes a previous value,
|
||||
causing future partitions to default to
|
||||
<varname>default_table_access_method</varname>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
Reference in New Issue
Block a user