Re: When to use name verses id
От | Tom Lane |
---|---|
Тема | Re: When to use name verses id |
Дата | |
Msg-id | 2491.1012838416@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | When to use name verses id (Lewis Bergman <lbergman@abi.tconline.net>) |
Ответы |
Re: When to use name verses id
|
Список | pgsql-novice |
Lewis Bergman <lbergman@abi.tconline.net> writes: > Do I even need an id column if I make the name column unique? You could dispense with an ID column (and IMHO should do so) if you can *guarantee* that the name column will always be unique. In a lot of practical situations that falls down --- eg, you'd be foolish to assume that a company will never have two employees named Tom Lane. The main reason people tend to use arbitrarily-assigned ID values is so they can be certain of having a unique primary key for the table, even when the other identifying info turns out to be less unique than it might at first seem. Integer IDs are probably also more compact and faster to compare than strings, but this effect is not so strong that it should govern your decisions. If you don't really need an ID column, I think you're better off without one. regards, tom lane
В списке pgsql-novice по дате отправления: