Re: int id's helpful for indexing, or just use text names?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: int id's helpful for indexing, or just use text names?
Дата
Msg-id 18502.1034716018@sss.pgh.pa.us
обсуждение исходный текст
Ответ на int id's helpful for indexing, or just use text names?  (george young <gry@ll.mit.edu>)
Список pgsql-sql
george young <gry@ll.mit.edu> 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


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

Предыдущее
От: 2000 Informática
Дата:
Сообщение: ADO with postgreSQL
Следующее
От: Jan Wieck
Дата:
Сообщение: Re: SQL function triggers