Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
blindman
Master Smack Fu Yak Hacker
2365 Posts |
Posted - 2005-11-07 : 10:38:12
|
| Begin a good boy, I always define a primary key on my tables. Now I am at a client site where their database tables have unique clustered indexes, but no explicitly defined primary key. Does anyone know if this could affect execution performance? |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2005-11-07 : 11:11:26
|
| Sure...you'd have to programmatically enforce RI.I beleive they left the PK's off because they beleive it would be a perf boost because it wouldn't have to write the PK Index...which is wrong...also is the cluster on what the PK would be anyway?Brett8-)Hint: Want your questions answered fast? Follow the direction in this linkhttp://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx |
 |
|
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2005-11-07 : 11:18:23
|
| Here's my opinion: It's good database design practice to create a primary key for all tables. However, if you have referencial integrety and uniqueness are handled by well placed unique constraints, and have properly indexed tables with carefull consideration to clustered indexes, I really don't think you'll get any enhanced performance boost by replacing a unique clustered index with a primary key. I think the important thing is referencial integrety, enforcing uniqueness, and proper indexing. As long as those bases are covered I don't think there's anything internally magical about a primary key.I hope someone will set me straight if I'm wrong about that.Be One with the OptimizerTG |
 |
|
|
Kristen
Test
22859 Posts |
Posted - 2005-11-07 : 13:14:14
|
| There are a bunch of 3rd Party thingie that expect to find a PK to do their work. Maybe they will happily work with a Unique Index, I don't know. How does Red-Gate compare handle that situation, for example?But that's about the only reason I can think of, and it might well be considered irrelevant to their environment.Kristen |
 |
|
|
|
|
|