X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0151852A88 for ; Tue, 28 Jun 2005 09:53:25 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 21403-04 for ; Tue, 28 Jun 2005 12:53:19 +0000 (GMT) Received: from wolff.to (wolff.to [66.93.197.194]) by svr1.postgresql.org (Postfix) with SMTP id 99FA052A36 for ; Tue, 28 Jun 2005 09:53:15 -0300 (ADT) Received: (qmail 21307 invoked by uid 500); 28 Jun 2005 12:53:18 -0000 Date: Tue, 28 Jun 2005 07:53:18 -0500 From: Bruno Wolff III To: orange_crush_068@hotmail.com Cc: pgsql-sql@postgresql.org Subject: Re: Unique primary index? Message-ID: <20050628125318.GC20566@wolff.to> Mail-Followup-To: Bruno Wolff III , orange_crush_068@hotmail.com, pgsql-sql@postgresql.org References: <1119530632.181638.4330@g49g2000cwa.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1119530632.181638.4330@g49g2000cwa.googlegroups.com> User-Agent: Mutt/1.5.6i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL X-Spam-Level: X-Archive-Number: 200506/338 X-Sequence-Number: 21939 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.