SqlServer database foreign keys confusion

Whether to use a foreign key in database design and data backup time has been very tangled. Let me talk about the advantages and disadvantages of foreign keys right

Advantages: ensure the integrity and consistency and reliability of data, a modification effect can do all of the information data corresponding to a foreign key are changed

Cons: Data Sheet increased, increasing the difficulty of development. Reduction (Insert, Update, Delete) Speed

Substituted foreign key method: trigger, the program

Orders usually we designed most of the data. Here to give orders sub-category

Orders generally have customers, order status, product, supplier, and other information.

These attributes are foreign keys and their respective descriptions, the order only if there is a foreign key information. We have the following questions.

1. query / add / modify / delete information when the need to involve these attributes corresponding table

2. Make a backup when the need to record information describing the corresponding also be backed up.

In order to do this operation when the performance will be relatively slow.

Is it necessary to back up these foreign key attributes in order to do the backup time. Because the backup of the significance is not great, because modifying the attribute information describing the recorded information can not be changed. Such descriptions should check out how to deal with issues need to be considered. But as the search condition, we can only access the latest property records, according to retrieve the Key. Or should we as a historical record with key value to retrieve. Feel the needs of customers is the key design decisions.

 

Guess you like

Origin www.cnblogs.com/feng-ye1192/p/SQL_FOREIGN_KEY.html