sql server - Should all tables be related in a Database or Is it ok to leave some of them? -


often come across small insignificant (debatable) tables left out stand alone. although used in joins (sparingly) still developers don't bother relate them.

may many references made inserts slow.

this leads question : as thumb rule should relate tables in database ? if no draw line?

thanks

foreign keys not negative impact performance, can positive impact well. database relationships more ensure referential integrity, teach sql server nature of data. fact 2 fields related can give clues cardinality of queries , optimizer takes these relationships consideration when it's estimating cost of query.

in opinion, if 2 fields related in database, should have defined relationship. in general, more can teach sql server data (not relationships, check constraints well), better @ generating efficient query plans. of course in sql server, there exceptions rule, if want rule of thumb, lean toward defining relationships.


Comments

Popular posts from this blog

How to group boxplot outliers in gnuplot -

cakephp - simple blog with croogo -

bash - Performing variable substitution in a string -