aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlvaro Herrera <alvherre@alvh.no-ip.org>2018-02-10 10:01:37 -0300
committerAlvaro Herrera <alvherre@alvh.no-ip.org>2018-02-10 10:06:01 -0300
commitfad15f4a547ad433a28c370bd071b08df9e65f10 (patch)
tree6c38133760044f4c0d62dd44da8a5e26c8943f83
parent935dee9ad5a8d12f4d3b772a6e6c99d245e5ad44 (diff)
downloadpostgresql-fad15f4a547ad433a28c370bd071b08df9e65f10.tar.gz
postgresql-fad15f4a547ad433a28c370bd071b08df9e65f10.zip
Mention partitioned indexes in "Data Definition" chapter
We can now create indexes more easily than before, so update this chapter to use the simpler instructions. After an idea of Amit Langote. I (Álvaro) opted to do more invasive surgery and remove the previous suggestion to create per-partition indexes, which his patch left in place. Discussion: https://postgr.es/m/eafaaeb1-f0fd-d010-dd45-07db0300f645@lab.ntt.co.jp Author: Amit Langote, Álvaro Herrera
-rw-r--r--doc/src/sgml/ddl.sgml22
1 files changed, 8 insertions, 14 deletions
diff --git a/doc/src/sgml/ddl.sgml b/doc/src/sgml/ddl.sgml
index 1e1f3428a6b..bee1ebd7dbc 100644
--- a/doc/src/sgml/ddl.sgml
+++ b/doc/src/sgml/ddl.sgml
@@ -3145,18 +3145,15 @@ CREATE TABLE measurement_y2006m02 PARTITION OF measurement
<listitem>
<para>
Create an index on the key column(s), as well as any other indexes you
- might want for every partition. (The key index is not strictly
+ might want, on the partitioned table. (The key index is not strictly
necessary, but in most scenarios it is helpful. If you intend the key
values to be unique then you should always create a unique or
- primary-key constraint for each partition.)
+ primary-key constraint for each partition.) This automatically creates
+ one index on each partition, and any partitions you create or attach
+ later will also contain the index.
<programlisting>
-CREATE INDEX ON measurement_y2006m02 (logdate);
-CREATE INDEX ON measurement_y2006m03 (logdate);
-...
-CREATE INDEX ON measurement_y2007m11 (logdate);
-CREATE INDEX ON measurement_y2007m12 (logdate);
-CREATE INDEX ON measurement_y2008m01 (logdate);
+CREATE INDEX ON measurement (logdate);
</programlisting>
</para>
</listitem>
@@ -3273,12 +3270,9 @@ ALTER TABLE measurement ATTACH PARTITION measurement_y2008m02
<itemizedlist>
<listitem>
<para>
- There is no facility available to create the matching indexes on all
- partitions automatically. Indexes must be added to each partition with
- separate commands. This also means that there is no way to create a
- primary key, unique constraint, or exclusion constraint spanning all
- partitions; it is only possible to constrain each leaf partition
- individually.
+ There is no way to create a primary key, unique constraint, or
+ exclusion constraint spanning all partitions; it is only possible
+ to constrain each leaf partition individually.
</para>
</listitem>