Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit b42f863

Browse files
committed
Merge branch 'PGPROEE10' into PGPROEE10_pg_shardman
2 parents 1b67f7e + 039ce82 commit b42f863

File tree

4 files changed

+112
-57
lines changed

4 files changed

+112
-57
lines changed

doc/src/sgml/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ version.sgml: $(top_srcdir)/configure
103103
echo "<!ENTITY version \"$(PGPRO_VERSION)\">"; \
104104
echo "<!ENTITY majorversion \"$(MAJORVERSION)\">"; \
105105
echo "<!ENTITY productname \"$(PRODUCT_NAME)\">"; \
106+
echo "<!ENTITY edition \"$(PGPRO_EDITION)\">"; \
106107
} > $@
107108

108109
features-supported.sgml: $(top_srcdir)/src/backend/catalog/sql_feature_packages.txt $(top_srcdir)/src/backend/catalog/sql_features.txt

doc/src/sgml/config.sgml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7646,6 +7646,41 @@ dynamic_library_path = 'C:\tools\postgresql;H:\my_project\lib;$libdir'
76467646
</listitem>
76477647
</varlistentry>
76487648

7649+
<varlistentry id="guc-partition-backend" xreflabel="partition_backend">
7650+
<term><varname>partition_backend</varname> (<type>string</type>)
7651+
<indexterm>
7652+
<primary><varname>partition_backend</> configuration parameter</primary>
7653+
</indexterm>
7654+
</term>
7655+
<listitem>
7656+
<para>
7657+
Defines the backend to use for range partitioning. Possible values are:
7658+
<itemizedlist spacing="compact">
7659+
<listitem>
7660+
<para>
7661+
<literal>internal</literal> &mdash; use
7662+
<productname>&productname;</productname> core functionality for
7663+
range and list partitioning. This value is incompatible
7664+
with declarative syntax for hash partitioning.
7665+
</para>
7666+
</listitem>
7667+
<listitem>
7668+
<para>
7669+
<literal>pg_pathman</literal> &mdash; use
7670+
<filename>pg_pathman</filename> for range and hash partitioning.
7671+
This value is incompatible with declarative syntax for list
7672+
partitioning. You must have <filename>pg_pathman</filename>
7673+
installed to use this value.
7674+
</para>
7675+
</listitem>
7676+
</itemizedlist>
7677+
</para>
7678+
<para>
7679+
Default: <literal>pg_pathman</literal>
7680+
</para>
7681+
</listitem>
7682+
</varlistentry>
7683+
76497684
<varlistentry id="guc-quote-all-identifiers" xreflabel="quote-all-identifiers">
76507685
<term><varname>quote_all_identifiers</varname> (<type>boolean</type>)
76517686
<indexterm>

doc/src/sgml/pgpathman.sgml

Lines changed: 40 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -521,61 +521,48 @@ SELECT add_range_partition('test',
521521
</para>
522522
</sect3>
523523
<sect3 id="pg-pathman-using-declarative-syntax">
524-
<title>Using <filename>pg_pathman</filename> Declarative Syntax</title>
524+
<title>Using Declarative Syntax</title>
525525
<para>
526-
The <filename>pg_pathman</filename> extension supports
527-
declarative SQL syntax for partitioning. Using this syntax, you can define partitioning strategy at the time of the table creation, as well as split the already created tables and manage partitions.
526+
<productname>&productname;</productname> provides declarative
527+
syntax for partitioning. Using this syntax, you can
528+
define partitioning strategy when creating a table, as well
529+
as partition existing tables and manage table partitions.
528530
</para>
529-
<para>When running the <command>CREATE TABLE</command> command, you can use the <literal>PARTITION BY</literal> clause to define tables partitioned by range or hash. </para>
530-
<para>For example, to create the <literal>abc</literal> table partitioned by range with interval 100, use the following <acronym>SQL</acronym> statement:</para>
531-
<programlisting>
532-
CREATE TABLE abc(id SERIAL)
533-
PARTITION BY RANGE(id) INTERVAL (100);
534-
</programlisting>
535-
<para>
536-
Instead of the <literal>INTERVAL</literal> parameter, you can specify the exact partitions to create, as well as the corresponding tablespaces:
537-
</para>
538-
<programlisting>
539-
CREATE TABLE abc(id SERIAL)
540-
PARTITION BY RANGE(id)
541-
(
542-
PARTITION abc_100 VALUES LESS THAN (100) TABLESPACE ts1,
543-
PARTITION abc_200 VALUES LESS THAN (200) TABLESPACE ts2
544-
);
545-
</programlisting>
546-
<para>
547-
When creating a table partitioned by hash, you can either specify the number of partitions to create, or the exact partitions and tablespaces. For example, to create the <literal>abc</literal> table with three partitions, run:
548-
</para>
549-
<programlisting>
550-
CREATE TABLE abc(id serial)
551-
PARTITION BY HASH (id) PARTITIONS (3);
552-
</programlisting>
553-
<para>To define the exact partitions to create, use the following statement:</para>
554-
<programlisting>
555-
CREATE TABLE abc(id serial)
556-
PARTITION BY HASH (id)
557-
(
558-
PARTITION abc_first TABLESPACE ts1,
559-
PARTITION abc_second TABLESPACE ts2
560-
);
561-
</programlisting>
562-
<para>You can also use the <literal>PARTITION BY</literal> clause with the <command>ALTER TABLE</command> <acronym>SQL</acronym> command to partition the already created tables. For example, to split table <literal>abc</literal> to three hash partitions, run:</para>
563-
<programlisting>
564-
ALTER TABLE abc PARTITION BY HASH (id) PARTITIONS (3);
565-
</programlisting>
566-
<para>When performing range partitioning, specify the lower bound of the first partition and the partitioning interval defining the range of values to include into a single partition:
567-
<programlisting>
568-
ALTER TABLE abc PARTITION BY RANGE (id) START FROM (0)
569-
INTERVAL (2000);
570-
</programlisting>
571-
The <literal>START FROM</literal> value must be not greater than the smallest value in the partitioning key column. Otherwise, <filename>pg_pathman</filename> returns the corresponding error.</para>
572-
<para>If it is critical to avoid downtime, you can use the optional <literal>CONCURRENTLY</literal> parameter when partitioning existing tables. In this case, <filename>pg_pathman</filename> creates empty partitions, and then migrates the data in batches of 1000 rows. For example, to partition a large table with the <literal>INTERVAL</literal> set to 50000, run:
573-
<programlisting>
574-
ALTER TABLE abc PARTITION BY RANGE (id) START FROM (0)
575-
INTERVAL (50000) CONCURRENTLY;
576-
</programlisting>
577-
</para>
578-
<para>Once the table is partitioned, you can use the <command>ALTER TABLE</command> command with partition management clauses provided by <filename>pg_pathman</filename> to add, remove, or modify partitions. For details, see <xref linkend="sql-altertable">.</para>
531+
<para>
532+
By default, <filename>pg_pathman</filename> extension is used
533+
for range and hash partitioning, while list partitioning is disabled.
534+
To use <productname>&productname;</productname> core functionality
535+
for partitioning, set the <xref linkend="guc-partition-backend">
536+
variable to <literal>internal</literal>. In this case, you can
537+
perform range and list partitioning.
538+
</para>
539+
<para>
540+
You can override the <xref linkend="guc-partition-backend"> setting
541+
by specifying the <literal>USING <replaceable>partition_backend</replaceable></literal>
542+
clause for the <xref linkend="sql-createtable"> command.
543+
</para>
544+
<para>
545+
The following partitioning clauses are not supported by
546+
<filename>pg_pathman</filename>:
547+
<itemizedlist>
548+
<listitem>
549+
<para>
550+
<command>PARTITION OF</command> clause for <xref linkend="sql-createtable">,
551+
<xref linkend="sql-createforeigntable">, <xref linkend="sql-altertable">
552+
</para>
553+
</listitem>
554+
<listitem>
555+
<para>
556+
<command>ATTACH PARTITION</command> and <command>DETACH PARTITION</command>
557+
clauses for <xref linkend="sql-altertable">
558+
</para>
559+
</listitem>
560+
</itemizedlist>
561+
If you would like to use these clauses, you have to set the <xref linkend="guc-partition-backend">
562+
variable to <literal>internal</literal>. For details on partitioning features
563+
provided by <productname>&productname;</productname> core, see <xref linkend="ddl-partitioning">.
564+
</para>
565+
579566
</sect3>
580567
</sect2>
581568
<sect2 id="pg-pathman-examples">

doc/src/sgml/ref/create_table.sgml

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } | UNLOGGED | CONSTANT ] TABLE [
2828
[, ... ]
2929
] )
3030
[ INHERITS ( <replaceable>parent_table</replaceable> [, ... ] ) ]
31-
[ PARTITION BY { RANGE | LIST } ( { <replaceable class="parameter">column_name</replaceable> | ( <replaceable class="parameter">expression</replaceable> ) } [ COLLATE <replaceable class="parameter">collation</replaceable> ] [ <replaceable class="parameter">opclass</replaceable> ] [, ... ] ) ]
31+
[ PARTITION BY { RANGE | LIST | HASH } ( { <replaceable class="parameter">column_name</replaceable> | ( <replaceable class="parameter">expression</replaceable> ) } [ COLLATE <replaceable class="parameter">collation</replaceable> ] [ <replaceable class="parameter">opclass</replaceable> ] [, ... ] ) [ USING <replaceable class="PARAMETER">partition_backend</replaceable> ] ]
3232
[ WITH ( <replaceable class="PARAMETER">storage_parameter</replaceable> [= <replaceable class="PARAMETER">value</replaceable>] [, ... ] ) | WITH OIDS | WITHOUT OIDS ]
3333
[ ON COMMIT { PRESERVE ROWS | DELETE ROWS | DROP } ]
3434
[ TABLESPACE <replaceable class="PARAMETER">tablespace_name</replaceable> ]
@@ -39,7 +39,7 @@ CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } | UNLOGGED | CONSTANT ] TABLE [
3939
| <replaceable>table_constraint</replaceable> }
4040
[, ... ]
4141
) ]
42-
[ PARTITION BY { RANGE | LIST } ( { <replaceable class="parameter">column_name</replaceable> | ( <replaceable class="parameter">expression</replaceable> ) } [ COLLATE <replaceable class="parameter">collation</replaceable> ] [ <replaceable class="parameter">opclass</replaceable> ] [, ... ] ) ]
42+
[ PARTITION BY { RANGE | LIST | HASH } ( { <replaceable class="parameter">column_name</replaceable> | ( <replaceable class="parameter">expression</replaceable> ) } [ COLLATE <replaceable class="parameter">collation</replaceable> ] [ <replaceable class="parameter">opclass</replaceable> ] [, ... ] ) [ USING <replaceable class="PARAMETER">partition_backend</replaceable> ] ]
4343
[ WITH ( <replaceable class="PARAMETER">storage_parameter</replaceable> [= <replaceable class="PARAMETER">value</replaceable>] [, ... ] ) | WITH OIDS | WITHOUT OIDS ]
4444
[ ON COMMIT { PRESERVE ROWS | DELETE ROWS | DROP } ]
4545
[ TABLESPACE <replaceable class="PARAMETER">tablespace_name</replaceable> ]
@@ -50,7 +50,7 @@ CREATE [ [ GLOBAL | LOCAL ] { TEMPORARY | TEMP } | UNLOGGED ] TABLE [ IF NOT EXI
5050
| <replaceable>table_constraint</replaceable> }
5151
[, ... ]
5252
) ] FOR VALUES <replaceable class="PARAMETER">partition_bound_spec</replaceable>
53-
[ PARTITION BY { RANGE | LIST } ( { <replaceable class="parameter">column_name</replaceable> | ( <replaceable class="parameter">expression</replaceable> ) } [ COLLATE <replaceable class="parameter">collation</replaceable> ] [ <replaceable class="parameter">opclass</replaceable> ] [, ... ] ) ]
53+
[ PARTITION BY { RANGE | LIST | HASH } ( { <replaceable class="parameter">column_name</replaceable> | ( <replaceable class="parameter">expression</replaceable> ) } [ COLLATE <replaceable class="parameter">collation</replaceable> ] [ <replaceable class="parameter">opclass</replaceable> ] [, ... ] ) [ USING <replaceable class="PARAMETER">partition_backend</replaceable> ] ]
5454
[ WITH ( <replaceable class="PARAMETER">storage_parameter</replaceable> [= <replaceable class="PARAMETER">value</replaceable>] [, ... ] ) | WITH OIDS | WITHOUT OIDS ]
5555
[ ON COMMIT { PRESERVE ROWS | DELETE ROWS | DROP } ]
5656
[ TABLESPACE <replaceable class="PARAMETER">tablespace_name</replaceable> ]
@@ -497,7 +497,7 @@ FROM ( { <replaceable class="PARAMETER">numeric_literal</replaceable> | <replace
497497
</varlistentry>
498498

499499
<varlistentry>
500-
<term><literal>PARTITION BY { RANGE | LIST } ( { <replaceable class="parameter">column_name</replaceable> | ( <replaceable class="parameter">expression</replaceable> ) } [ <replaceable class="parameter">opclass</replaceable> ] [, ...] ) </literal></term>
500+
<term><literal>PARTITION BY { RANGE | LIST | HASH } ( { <replaceable class="parameter">column_name</replaceable> | ( <replaceable class="parameter">expression</replaceable> ) } [ <replaceable class="parameter">opclass</replaceable> ] [, ...] ) [ USING <replaceable class="PARAMETER">partition_backend</replaceable> ] </literal></term>
501501
<listitem>
502502
<para>
503503
The optional <literal>PARTITION BY</literal> clause specifies a strategy
@@ -529,6 +529,38 @@ FROM ( { <replaceable class="PARAMETER">numeric_literal</replaceable> | <replace
529529
these constraints on individual partitions.
530530
</para>
531531

532+
<para>
533+
Optionally, you can choose the backend that performs partitioning by specifying the
534+
<literal>USING <replaceable class="parameter">partition_backend</replaceable></literal>
535+
clause, where <replaceable class="parameter">partition_backend</replaceable>
536+
can be one of the following:
537+
<itemizedlist spacing="compact">
538+
<listitem>
539+
<para>
540+
<literal>internal</literal> &mdash; use
541+
<productname>&productname;</productname> core functionality for
542+
range and list partitioning.
543+
This value cannot be used for hash partitioning.
544+
</para>
545+
</listitem>
546+
<listitem>
547+
<para>
548+
<literal>pg_pathman</literal> &mdash; use
549+
<filename>pg_pathman</filename> for range and hash partitioning.
550+
This value cannot be used for list partitioning.
551+
You must have <filename>pg_pathman</filename> installed
552+
to use this value.
553+
</para>
554+
</listitem>
555+
</itemizedlist>
556+
If you omit the <literal>USING <replaceable class="parameter">partition_backend</replaceable></literal>
557+
clause, the backend for partitioning is defined
558+
by the <xref linkend="guc-partition-backend"> variable.
559+
The default value is <literal>pg_pathman</literal>, so you must
560+
have the <literal>pg_pathman</literal> extension installed to
561+
use the <literal>PARTITION BY</literal> clause.
562+
</para>
563+
532564
</listitem>
533565
</varlistentry>
534566

0 commit comments

Comments
 (0)