Re: Unique primary index? - Mailing list pgsql-sql

From Bruno Wolff III
Subject Re: Unique primary index?
Date
Msg-id 20050628125318.GC20566@wolff.to
Whole thread Raw
In response to Unique primary index?  (orange_crush_068@hotmail.com)
List pgsql-sql
On Thu, Jun 23, 2005 at 05:43:52 -0700, orange_crush_068@hotmail.com wrote:
> 
> What are the major differences between Unique, primary index & just
> plain index?
> 
> When creating tables I nominate one of these, but not sure what the
> difference is?

A unique key has an implied constraint that no two nonnull values can
be the same. This is implemented using a unique index which is automatically
created.

A primary key is a unique key that has an implied not null constraint and
is the default for foreign key references into the table.

You can also create stand alone indexes for performance reasons or to
enforce a unique constraint on a subset of a table.


pgsql-sql by date:

Previous
From: Bruno Wolff III
Date:
Subject: Re: cross-table reference
Next
From: PFC
Date:
Subject: Re: Unique primary index?