Received: from shire.ontko.com (shire.ontko.com [199.164.165.1]) by postgresql.org (Postfix) with ESMTP id 55764479A44 for ; Mon, 15 Apr 2002 15:21:17 -0400 (EDT) Received: from nick (bilbo.ontko.com [199.164.165.101]) by shire.ontko.com (8.9.3/8.9.3/Debian 8.9.3-21) with SMTP id OAA22953; Mon, 15 Apr 2002 14:21:16 -0500 X-Authentication-Warning: shire.ontko.com: Host bilbo.ontko.com [199.164.165.101] claimed to be nick Reply-To: From: "Nick Fankhauser" To: "Jodi Kanter" , "Postgres Admin List" Subject: Re: string PK vs. interger PK Date: Mon, 15 Apr 2002 14:20:06 -0500 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2911.0) X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Importance: Normal In-Reply-To: <019201c1e4af$3b855c90$de138f80@virginia.edu> X-Archive-Number: 200204/137 X-Sequence-Number: 4025 As a general rule, a primary key (or any relationship key) should not contain a value that means something beyond its use in relating entities. The problem is that if a field describes an object, the day may come when you want to change the description, but you *never* want to change the field that identifies the record and relates it to other records. I can't offer insider's knowledge on speed of int vs string, but it seems very reasonable to think that an int would be faster. On the other hand, I'm forced to use strings in my app, and the performance doesn't suffer much so they must be close. -Nick -------------------------------------------------------------------------- Nick Fankhauser nickf@ontko.com Phone 1.765.935.4283 Fax 1.765.962.9788 Ray Ontko & Co. Software Consulting Services http://www.ontko.com/ -----Original Message----- From: pgsql-admin-owner@postgresql.org [mailto:pgsql-admin-owner@postgresql.org]On Behalf Of Jodi Kanter Sent: Monday, April 15, 2002 1:56 PM To: Postgres Admin List Subject: [ADMIN] string PK vs. interger PK Can anyone offer some insight as to what should be considered when choosing between a primary key that is an integer vs. a primary key that is a string value? Does one or the other affect indexing speed? update speed? Is a serial integer value better than using a PK that has some "value" in its meaning but is a string? Thanks Jodi _______________________________ Jodi L Kanter BioInformatics Database Administrator University of Virginia (434) 924-2846 jkanter@virginia.edu