Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 9D5F5475F7F for ; Tue, 15 Oct 2002 17:06:58 -0400 (EDT) Received: from sss.pgh.pa.us (unknown [192.204.191.242]) by postgresql.org (Postfix) with ESMTP id DC379475C3D for ; Tue, 15 Oct 2002 17:06:57 -0400 (EDT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.12.5/8.12.5) with ESMTP id g9FL6whR018503; Tue, 15 Oct 2002 17:06:58 -0400 (EDT) To: gry@ll.mit.edu Cc: pgsql-sql@postgresql.org Subject: Re: int id's helpful for indexing, or just use text names? In-reply-to: <20021015151647.65521b8d.gry@ll.mit.edu> References: <20021015151647.65521b8d.gry@ll.mit.edu> Comments: In-reply-to george young message dated "Tue, 15 Oct 2002 15:16:47 -0400" Date: Tue, 15 Oct 2002 17:06:58 -0400 Message-ID: <18502.1034716018@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/169 X-Sequence-Number: 9886 george young writes: > The question is: would I be better off losing all those integer ids > and just using the text names as primary indices? Is there much > performance lost comparing text strings for every index operation? Strings would be slower, but possibly not by enough to notice. The real question you should ask yourself is whether your text names are really good candidates to be primary keys. Are there ever any duplicates? Do you ever rename objects? If your answer to either is "yes" then the names won't do as unique identifiers. There's an old saying that meaningful keys are bad database design; check the mailing list archives for some examples. (F'r instance, I seem to recall a story about a bank that embedded branch numbers into account numbers, and then had terrible troubles anytime a customer moved...) regards, tom lane