Re: Table design question

Поиск
Список
Период
Сортировка
От Greg Stark
Тема Re: Table design question
Дата
Msg-id 87slmohoj8.fsf@stark.xeocode.com
обсуждение исходный текст
Ответ на Table design question  ("David Clarke" <pigwin32@gmail.com>)
Список pgsql-sql
"David Clarke" <pigwin32@gmail.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



В списке pgsql-sql по дате отправления:

Предыдущее
От: Miroslav Šulc
Дата:
Сообщение: Re: SELECT DISTINCT too slow
Следующее
От: Alvaro Herrera
Дата:
Сообщение: Re: SELECT DISTINCT too slow