Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit12b9aff

Browse files
committed
Tweak partitioning documentation wording
For clarity, precision, grammar.Author: Justin PryzbyReviewed-by: Amit Langote, Álvaro HerreraDiscussion:https://postgr.es/m/20180523213513.GM30060@telsasoft.com
1 parentef31095 commit12b9aff

File tree

1 file changed

+46
-40
lines changed

1 file changed

+46
-40
lines changed

‎doc/src/sgml/ddl.sgml

Lines changed: 46 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -2979,15 +2979,16 @@ VALUES ('Albany', NULL, NULL, 'NY');
29792979
<para>
29802980
Individual partitions are linked to the partitioned table with inheritance
29812981
behind-the-scenes; however, it is not possible to use some of the
2982-
inheritance features discussed in the previous section with partitioned
2983-
tables and partitions. For example, a partition cannot have any parents
2984-
other than the partitioned table it is a partition of, nor can a regular
2985-
table inherit from a partitioned table making the latter its parent.
2986-
That means partitioned tables and partitions do not participate in
2987-
inheritance with regular tables. Since a partition hierarchy consisting
2988-
of the partitioned table and its partitions is still an inheritance
2989-
hierarchy, all the normal rules of inheritance apply as described in
2990-
<xref linkend="ddl-inherit"/> with some exceptions, most notably:
2982+
generic features of inheritance (discussed below) with declaratively
2983+
partitioned tables or their partitions. For example, a partition
2984+
cannot have any parents other than the partitioned table it is a
2985+
partition of, nor can a regular table inherit from a partitioned table
2986+
making the latter its parent. That means partitioned tables and their
2987+
partitions do not participate in inheritance with regular tables.
2988+
Since a partition hierarchy consisting of the partitioned table and its
2989+
partitions is still an inheritance hierarchy, all the normal rules of
2990+
inheritance apply as described in <xref linkend="ddl-inherit"/> with
2991+
some exceptions, most notably:
29912992

29922993
<itemizedlist>
29932994
<listitem>
@@ -3003,23 +3004,28 @@ VALUES ('Albany', NULL, NULL, 'NY');
30033004
<listitem>
30043005
<para>
30053006
Using <literal>ONLY</literal> to add or drop a constraint on only the
3006-
partitioned table is supportedwhen there are no partitions. Once
3007+
partitioned table is supportedas long as there are no partitions. Once
30073008
partitions exist, using <literal>ONLY</literal> will result in an error
30083009
as adding or dropping constraints on only the partitioned table, when
3009-
partitions exist, is not supported. Instead, constraints can be added
3010-
or dropped, when they are not present in the parent table, directly on
3011-
the partitions. As a partitioned table does not have any data
3012-
directly, attempts to use <command>TRUNCATE</command>
3013-
<literal>ONLY</literal> on a partitioned table will always return an
3014-
error.
3010+
partitions exist, is not supported. Instead, constraints on the
3011+
partitions themselves can be added and (if they are not present in the
3012+
parent table) dropped.
3013+
</para>
3014+
</listitem>
3015+
3016+
<listitem>
3017+
<para>
3018+
As a partitioned table does not have any data directly, attempts to use
3019+
<command>TRUNCATE</command> <literal>ONLY</literal> on a partitioned
3020+
table will always return an error.
30153021
</para>
30163022
</listitem>
30173023

30183024
<listitem>
30193025
<para>
30203026
Partitions cannot have columns that are not present in the parent. It
3021-
isneither possible to specify columns when creating partitions with
3022-
<command>CREATE TABLE</command> nor is it possible to add columns to
3027+
isnot possible to specify columns when creating partitions with
3028+
<command>CREATE TABLE</command>, nor is it possible to add columns to
30233029
partitions after-the-fact using <command>ALTER TABLE</command>. Tables may be
30243030
added as a partition with <command>ALTER TABLE ... ATTACH PARTITION</command>
30253031
only if their columns exactly match the parent, including any
@@ -3044,7 +3050,7 @@ VALUES ('Albany', NULL, NULL, 'NY');
30443050

30453051
<para>
30463052
Updating the partition key of a row might cause it to be moved into a
3047-
different partition where this row satisfiesits partitionconstraint.
3053+
different partition where this row satisfiesthe partitionbounds.
30483054
</para>
30493055

30503056
<sect3 id="ddl-partitioning-declarative-example">
@@ -3358,15 +3364,15 @@ ALTER TABLE measurement ATTACH PARTITION measurement_y2008m02
33583364
While the built-in declarative partitioning is suitable for most
33593365
common use cases, there are some circumstances where a more flexible
33603366
approach may be useful. Partitioning can be implemented using table
3361-
inheritance, which allows for several featureswhich arenot supported
3367+
inheritance, which allows for several features not supported
33623368
by declarative partitioning, such as:
33633369

33643370
<itemizedlist>
33653371
<listitem>
33663372
<para>
3367-
Partitioning enforces a rule that allpartitions must have exactly
3368-
the same setof columns as theparent, buttable inheritance allows
3369-
children to have extra columns not present in the parent.
3373+
For declarative partitioning,partitions must have exactly the same set
3374+
of columns as thepartitioned table, whereas withtable inheritance,
3375+
child tables may have extra columns not present in the parent.
33703376
</para>
33713377
</listitem>
33723378

@@ -3768,7 +3774,8 @@ ANALYZE measurement;
37683774

37693775
<para>
37703776
<firstterm>Partition pruning</firstterm> is a query optimization technique
3771-
that improves performance for partitioned tables. As an example:
3777+
that improves performance for declaratively partitioned tables.
3778+
As an example:
37723779

37733780
<programlisting>
37743781
SET enable_partition_pruning = on; -- the default
@@ -3786,12 +3793,11 @@ SELECT count(*) FROM measurement WHERE logdate &gt;= DATE '2008-01-01';
37863793
</para>
37873794

37883795
<para>
3789-
You can use the <command>EXPLAIN</command> command to show the
3790-
difference between a plan whose partitions have been pruned from one
3791-
whose partitions haven't, by using the
3792-
<xref linkend="guc-enable-partition-pruning"/> configuration
3793-
parameter. A typical unoptimized plan for this type of table setup
3794-
is:
3796+
By using the EXPLAIN command and the <xref
3797+
linkend="guc-enable-partition-pruning"/> configuration parameter, it's
3798+
possible to show the difference between a plan for which partitions have
3799+
been pruned and one for which they have not. A typical unoptimized
3800+
plan for this type of table setup is:
37953801
<programlisting>
37963802
SET enable_partition_pruning = off;
37973803
EXPLAIN SELECT count(*) FROM measurement WHERE logdate &gt;= DATE '2008-01-01';
@@ -3892,9 +3898,9 @@ EXPLAIN SELECT count(*) FROM measurement WHERE logdate &gt;= DATE '2008-01-01';
38923898
Currently, pruning of partitions during the planning of an
38933899
<command>UPDATE</command> or <command>DELETE</command> command is
38943900
implemented using the constraint exclusion method (however, it is
3895-
still ruledby the <literal>enable_partition_pruning</literal>
3896-
setting instead of<literal>constraint_exclusion</literal>) &mdash;
3897-
see the next sectionfor details and caveats that apply.
3901+
controlledby the <literal>enable_partition_pruning</literal> rather than
3902+
<literal>constraint_exclusion</literal>) &mdash; see the following section
3903+
for details and caveats that apply.
38983904
</para>
38993905

39003906
<para>
@@ -3927,10 +3933,10 @@ EXPLAIN SELECT count(*) FROM measurement WHERE logdate &gt;= DATE '2008-01-01';
39273933
Constraint exclusion works in a very similar way to partition
39283934
pruning, except that it uses each table's <literal>CHECK</literal>
39293935
constraints &mdash; which gives it its name &mdash; whereas partition
3930-
pruning uses the table'spartitioning constraint, which exists only in
3931-
thecase of declarative partitioning. Another difference is that it
3932-
is only applied at plan time; there is no attempt to remove
3933-
partitions at execution time.
3936+
pruning uses the table'spartition bounds, which exists only in the
3937+
case of declarative partitioning. Another difference is that
3938+
constraint exclusionis only applied at plan time; there is no attempt
3939+
to removepartitions at execution time.
39343940
</para>
39353941

39363942
<para>
@@ -3959,8 +3965,8 @@ EXPLAIN SELECT count(*) FROM measurement WHERE logdate &gt;= DATE '2008-01-01';
39593965
<itemizedlist>
39603966
<listitem>
39613967
<para>
3962-
Constraint exclusion is only applied during query planning;it is
3963-
not applied at execution time like partition pruning does.
3968+
Constraint exclusion is only applied during query planning;unlike
3969+
partition pruning, it cannot be applied during query execution.
39643970
</para>
39653971
</listitem>
39663972

@@ -3970,7 +3976,7 @@ EXPLAIN SELECT count(*) FROM measurement WHERE logdate &gt;= DATE '2008-01-01';
39703976
clause contains constants (or externally supplied parameters).
39713977
For example, a comparison against a non-immutable function such as
39723978
<function>CURRENT_TIMESTAMP</function> cannot be optimized, since the
3973-
planner cannot know which partition the function value might fall
3979+
planner cannot know which partition the function's value might fall
39743980
into at run time.
39753981
</para>
39763982
</listitem>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp