> (Data|State) Management and Processing > (Data Type|Data Structure) > (Text|String|Character)

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
data:modeling:foreign_key [2017/09/13 21:21]
gerardnico ↷ Page moved from data_modeling:foreign_key to data:modeling:foreign_key
data:modeling:foreign_key [2019/11/21 09:50] (current)
gerardnico [3 - Pro / cons]
Line 2: Line 2:
 ===== About ===== ===== About =====
-A Foreign Key (also known as as foreign key constraint) is:+A Foreign Key is [[constraint|constraint]] on :
   * a column ​   * a column ​
   * or combination of columns ​   * or combination of columns ​
-used to establish and enforce a [[relationship|relationship]] between data in two tables. ​+used to establish and enforce a [[one-to-many|one to many relationship]] between data in two tables. ​
-Usually the foreign key is coupled with the [[primary key|primary key]] of the other table.+This is also known as foreign key/primary key relationships 
 +The link is created between ​the two tables by defining on the foreign table the column (or columns) that hold data from an other table'​s ​[[primary key|primary key]] **values**. 
 +[[Referential Integrity|Referential Integrity]] is a data property whereby a Foreign Key in one table has a corresponding Primary key in a different ​table.
 ===== Articles Related ===== ===== Articles Related =====
 {{backlinks>​.}} {{backlinks>​.}}
 +===== Pro / cons =====
 +  * [[data:​partition:​sharding|sharding]]:​ Extracting data with foreigns keys is hard and therefore [[data:​partition:​sharding|sharding]] is hard
 +  * Performance:​ An [[data:​type:​relation:​index:​index|index]] lookup is executed for each insert/​delete
 ===== Example ===== ===== Example =====
Line 34: Line 43:
 If it's not true, there is NO [[referential_integrity|referential integrity]]. If it's not true, there is NO [[referential_integrity|referential integrity]].
 +===== Documentation =====
 +  * [[https://​github.com/​github/​gh-ost/​issues/​331|Thoughts on Foreign Keys in Github? ]]
data/modeling/foreign_key.1505330490.txt.gz · Last modified: 2017/09/13 21:21 by gerardnico