*** a/doc/src/sgml/ddl.sgml --- b/doc/src/sgml/ddl.sgml *************** *** 550,555 **** CREATE TABLE products ( --- 550,563 ---- + Adding a unique constraint will automatically create a unique btree + index on the column or group of columns declared for the constraint. + The index name will match the name given to the constraint; if no + constraint name is specified, it will be the table name suffixed + with _columnname_key. + + + In general, a unique constraint is violated when there is more than one row in the table where the values of all of the columns included in the constraint are equal. *************** *** 623,628 **** CREATE TABLE example ( --- 631,644 ---- + Adding a primary key will automatically create a unique btree index + on the column or group of columns declared for the primary key. + The index name will match the name given to the constraint; if no + constraint name is specified, it will be the table name suffixed + with _pkey. + + + A table can have at most one primary key. (There can be any number of unique and not-null constraints, which are functionally the same thing, but only one can be identified as the primary key.) *************** *** 832,837 **** CREATE TABLE order_items ( --- 848,863 ---- + Since a DELETE of a row from a referenced table + or an UPDATE of a referenced column will require + a scan of the referencing table for rows matching the old value, it + is often a good idea to index the referencing columns. Because it + is not always needed, and there are many choices available on how + index, declaration of a foreign key constraint does not + automatically create an index. + + + More information about updating and deleting data is in . *************** *** 875,880 **** CREATE TABLE circles ( --- 901,915 ---- See also CREATE TABLE ... CONSTRAINT ... EXCLUDE for details. + + + Adding an exclusion constraint will automatically create an index + of the type specified in the constraint declaration. The index + name will match the name given to the constraint; if no constraint + name is specified, it will be the table name and column names used + in the constraint, separated by underscores, suffixed with + _excl. +