X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id 56DC89FA040 for ; Thu, 1 Jun 2006 12:41:17 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 26429-02 for ; Thu, 1 Jun 2006 12:41:13 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from stark.xeocode.com (stark.xeocode.com [216.58.44.227]) by postgresql.org (Postfix) with ESMTP id AC20C9FA5E1 for ; Thu, 1 Jun 2006 12:41:13 -0300 (ADT) Received: from localhost ([127.0.0.1] helo=stark.xeocode.com) by stark.xeocode.com with smtp (Exim 3.36 #1 (Debian)) id 1FlpIB-0001nu-00; Thu, 01 Jun 2006 11:40:59 -0400 To: "David Clarke" Cc: pgsql-sql@postgresql.org Subject: Re: Table design question References: <12b7ac1e0606010405u6e062f71mf4adbaeb6c46df5f@mail.gmail.com> In-Reply-To: <12b7ac1e0606010405u6e062f71mf4adbaeb6c46df5f@mail.gmail.com> From: Greg Stark Organization: The Emacs Conspiracy; member since 1992 Date: 01 Jun 2006 11:40:59 -0400 Message-ID: <87slmohoj8.fsf@stark.xeocode.com> Lines: 30 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200606/10 X-Sequence-Number: 25246 "David Clarke" writes: > is it really that big an issue these days to have a 100 character primary > key? Are there postgres-specific implications for either approach? It's exactly the same size issue as ever. A 20% increase in space usage is a 20% performance hit in certain types of queries regardless of how fast or cheap your hardware has become. This is an issue where reasonable people differ quite vociferously so you may get contradictory responses. But really it depends heavily on the exact circumstances and requires a judgement call based on experience. Any time someone tries to sum it up with a blanket rule it's going to be wrong some of the time. But that said I also tend to tilt towards creating serial ids. Unless the string is already a synthetic unique identifier created by your application you can't really trust its "uniqueness" for all time. Plenty of people have built databases using natural unique keys that turned out to be not so unique or turned out to just be a poor choice for external reasons (think of Social Security Numbers, for example). I've had my string unique identifiers corrupted by uppercasing, declared case insensitive, declared private information that couldn't be leaked, and declared offensive words that had to be updated. Each of which is a pain to deal with when it's your primary key. -- greg