On Thu, 01 Jun 2006, David Clarke wrote: > So I'm designing a table and I'm looking for an appropriate key. The > natural key is a string from a few characters up to a maximum of > perhaps 100. Joe gets quite fierce about avoiding the use of a serial > id column as a key. The string is unique in the table and fits the
The use of surrogate keys is a mostly religious issue. Celko is an Orthodox, many others are Reform. Where you want to align yourself is a personal choice. In defense of the Reform movement, I'd note that modern DBs are more performant with ints than varchars. More importantly, I've found it much easier to modify DBs designed with surrogate keys than natural keys, especially when natural keys span columns. It allows a rather simple convention for coders to write against, and avoids some messy modification issues when the spec changes. It is not my intention to bash the purists, and there are good arguments on the Ortho side, too. I'm merely giving a bit of advice from the point of view of someone who lives in the constant evolution side of DB usage. -j -- Jamie Lawrence [EMAIL PROTECTED] When I was a boy I was told that anybody could become President. Now I'm beginning to believe it. - Clarence Darrow ---------------------------(end of broadcast)--------------------------- TIP 9: In versions below 8.0, the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match