pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruno Wolff III <bruno@wolff.to>
To: orange_crush_068@hotmail.com
Cc: pgsql-sql@postgresql.org
Subject: Re: Unique primary index?
Date: Tue, 28 Jun 2005 07:53:18 -0500
Message-ID: <20050628125318.GC20566@wolff.to> (raw)
In-Reply-To: <1119530632.181638.4330@g49g2000cwa.googlegroups.com>
References: <1119530632.181638.4330@g49g2000cwa.googlegroups.com>

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.



view thread (5+ messages)  latest in thread

Message-ID: <20050628125318.GC20566@wolff.to>
Permalink:  ../20050628125318.GC20566@wolff.to/
Also on:    postgresql.org/message-id/20050628125318.GC20566@wolff.to

 · 

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: pgsql-sql@postgresql.org
  Cc: bruno@wolff.to, orange_crush_068@hotmail.com
  Subject: Re: Unique primary index?
  In-Reply-To: <20050628125318.GC20566@wolff.to>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox