X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 25150D1B473 for ; Tue, 16 Dec 2003 22:48:37 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 21457-08 for ; Tue, 16 Dec 2003 18:48:08 -0400 (AST) Received: from bob.samurai.com (bob.samurai.com [205.207.28.75]) by svr1.postgresql.org (Postfix) with ESMTP id 1D321D1CA77 for ; Tue, 16 Dec 2003 18:48:06 -0400 (AST) Received: from tokyo.samurai.com (d226-89-59.home.cgocable.net [24.226.89.59]) by bob.samurai.com (Postfix) with ESMTP id 68DA522C4; Tue, 16 Dec 2003 17:48:07 -0500 (EST) To: "Sean P. Thomas" Cc: pgsql-performance@postgresql.org Subject: Re: Optimizing FK & PK performance... From: Neil Conway In-Reply-To: <3FD89D72.8080508@ulanji.com> (Sean P. Thomas's message of "Thu, 11 Dec 2003 11:38:10 -0500") References: <3FD89D72.8080508@ulanji.com> Date: Tue, 16 Dec 2003 17:47:59 -0500 Message-ID: <87fzfkl6qo.fsf@mailbox.samurai.com> User-Agent: Gnus/5.1002 (Gnus v5.10.2) XEmacs/21.4 (Reasonable Discussion, linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200312/240 X-Sequence-Number: 5100 "Sean P. Thomas" writes: > 1. Is there any performance difference for declaring a primary or > foreign key a column or table contraint? From the documentation, > which way is faster and/or scales better: > > CREATE TABLE distributors ( > did integer, > name varchar(40), > PRIMARY KEY(did) > ); > > CREATE TABLE distributors ( > did integer PRIMARY KEY, > name varchar(40) > ); These are equivalent -- the performance should be the same. -Neil