Re: Table design question

From: Greg Stark <gsstark(at)mit(dot)edu>
To: "David Clarke" <pigwin32(at)gmail(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Table design question
Date: 2006-06-01 15:40:59
Message-ID: 87slmohoj8.fsf@stark.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql


"David Clarke" <pigwin32(at)gmail(dot)com> 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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Alvaro Herrera 2006-06-01 15:46:13 Re: SELECT DISTINCT too slow
Previous Message Miroslav Šulc 2006-06-01 15:39:48 Re: SELECT DISTINCT too slow