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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Any limit to foreign keys?

Author  Topic 

aiken
Aged Yak Warrior

525 Posts

Posted - 2002-04-15 : 19:50:41
I've got a "users" table that's at the heart of my app. At the moment, it has 16 FK's defined. I was about to add a few more, but for some reason I remember something about a 16 key limit.

Did I dream that, or is there any kind of practical limit to foreign keys?

Thanks
-b

robvolk
Most Valuable Yak

15732 Posts

Posted - 2002-04-15 : 20:46:40
Actually, a foreign key is limited to 16 columns per key, up to 253 foreign keys per table (SQL 2000, but I'm pretty sure it's the same for 7.0)

Practically speaking, as long as your tables perform to your expectations with that many foreign keys, then stick with it. If adding more foreign keys affects performance negatively, then you might want to reconsider your table designs and denormalize them somewhat.

Go to Top of Page

aiken
Aged Yak Warrior

525 Posts

Posted - 2002-04-15 : 21:02:55
Ah, ok, I was confusing the 16 and 253 limits. 253 should be fine.

Things seem fine with the number of keys now. I do have checks turned off on a few of the keys that affect tables with high insert volumes.

Cheers
-b

Go to Top of Page
   

- Advertisement -