Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Loosely Coupled Database Design - How To?

I'm implementing a web - based application using silverlight with an SQL Server DB on the back end for all the data that the application will display. I want to ensure that the application can be easily scalable and I feel the direction to go in with this is to make the database loosely coupled and not to tie everything up with foreign keys. I've tried searching for some examples but to no avail.

Does anyone have any information or good starting points/samples/examples to help me get off the ground with this?

Help greatly appreciated.

Kind regards,

like image 573
Goober Avatar asked Sep 14 '09 11:09

Goober


2 Answers

I think you're mixing up your terminology a bit. "Loosely coupled" refers to the desirability of having software components that aren't so dependent upon each other that they can't function or even compile without being together in the same program. I've never seen the term used to describe the relationships between tables in the same database.

I think if you search on the terms "normalization" and "denormalization" you'll get better results.

like image 182
MusiGenesis Avatar answered Sep 20 '22 03:09

MusiGenesis


Unless you're doing massive amounts of inserts at a time, like with a data warehouse, use foreign keys. Normalization scales like crazy, and you should take advantage of that. Foreign keys are fast, and the constraint really only holds you back if you're inserting millions upon millions of records at a time.

Make sure that you're using integer keys that have a clustered index on them. This should make joining table very rapid. The issues you can get yourself wrapped around without foreign keys are many and frustrating. I just spent all weekend doing so, and we made a conscious choice to not have foreign keys (we have terabytes of data, though).

like image 33
Eric Avatar answered Sep 23 '22 03:09

Eric