Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

9
  • I agree that it is redundant in terms of enforcing uniqueness and referential integrity. However, having a single value to identify a unique row can make certain complex queries simpler. I'd say (and this is deliberately redundant) the surrogate key is only required if you have a query where it's required. Commented Jun 27, 2011 at 12:58
  • Even if you don't need it now - having a surrogate key makes it so much easier to use an ORM at some point in the future. Commented Jun 27, 2011 at 18:04
  • @BonyT: ORMs are broken. See here for a detailed exposition of why I say this. Commented Jun 28, 2011 at 9:09
  • @Dems: It would only make queries simpler if some other relation had a foreign key on the surrogate. Since evidently nothing currently has a foreign on the existing candidate key, this wouldn't be the case. Commented Jun 28, 2011 at 9:11
  • @Marcelo - I disagree - quite strongly with your statement, but I suspect we share common sentiments. Having worked without an ORM, with home baked ORM's, and with NHibernate then I know which I prefer. However, bolting on an ORM to a schema design badly designed for it is just plain stupid. Like anything else in the software industry ORM is a tool, and any tool can be misused. Commented Jun 28, 2011 at 9:17