public inbox for [email protected]
help / color / mirror / Atom feedFrom: Josh Kupershmidt <[email protected]>
To: pgsql-docs <[email protected]>
Subject: Outdated note about unique indexes
Date: Wed, 8 Jul 2015 17:56:09 -0400
Message-ID: <CAK3UJRE4wGWMjGOfUZcTAOn_k43ETi-jh6FsLF7XX3=Qmkdt3A@mail.gmail.com> (raw)
List-Unsubscribe: <mailto:[email protected]?body=unsub%20pgsql-docs>
Hi,
I noticed that the note on a page about unique indexes
http://www.postgresql.org/docs/current/static/indexes-unique.html
says "The preferred way to add a unique constraint to a table is ALTER
TABLE ... ADD CONSTRAINT. The use of indexes to enforce unique constraints
could be considered an implementation detail that should not be accessed
directly... ".
That note has been there forever, in particular since before we supported
CONCURRENTLY, which is pretty darn important in many uses nowadays. Since
it seems like some users have taken this suggestion seriously, e.g. on
stackoverflow[1], how about we remove this outdated suggestion? There is
already a previous mention a few sections earlier[2] suggesting the use of
CONCURRENTLY, so I don't think we really need to reiterate that suggestion
here.
Josh
[1]
http://stackoverflow.com/questions/23542794/postgres-unique-constraint-vs-index
[2] http://www.postgresql.org/docs/current/interactive/indexes-intro.html
diff --git a/doc/src/sgml/indices.sgml b/doc/src/sgml/indices.sgml
index 309fd12..2d131c9 100644
--- a/doc/src/sgml/indices.sgml
+++ b/doc/src/sgml/indices.sgml
@@ -655,11 +655,7 @@ CREATE UNIQUE INDEX <replaceable>name</replaceable> ON <replaceable>table</repla
<note>
<para>
- The preferred way to add a unique constraint to a table is
- <literal>ALTER TABLE ... ADD CONSTRAINT</literal>. The use of
- indexes to enforce unique constraints could be considered an
- implementation detail that should not be accessed directly.
- One should, however, be aware that there's no need to manually
+ There's no need to manually
create indexes on unique columns; doing so would just duplicate
the automatically-created index.
</para>
--
Sent via pgsql-docs mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-docs
Attachments:
[text/plain] indices_constraint_suggestion.diff (769B, 3-indices_constraint_suggestion.diff)
download | inline diff:
diff --git a/doc/src/sgml/indices.sgml b/doc/src/sgml/indices.sgml
index 309fd12..2d131c9 100644
--- a/doc/src/sgml/indices.sgml
+++ b/doc/src/sgml/indices.sgml
@@ -655,11 +655,7 @@ CREATE UNIQUE INDEX <replaceable>name</replaceable> ON <replaceable>table</repla
<note>
<para>
- The preferred way to add a unique constraint to a table is
- <literal>ALTER TABLE ... ADD CONSTRAINT</literal>. The use of
- indexes to enforce unique constraints could be considered an
- implementation detail that should not be accessed directly.
- One should, however, be aware that there's no need to manually
+ There's no need to manually
create indexes on unique columns; doing so would just duplicate
the automatically-created index.
</para>
view thread (3+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected]
Subject: Re: Outdated note about unique indexes
In-Reply-To: <CAK3UJRE4wGWMjGOfUZcTAOn_k43ETi-jh6FsLF7XX3=Qmkdt3A@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox