https://stackoverflow.com/questions/4089830/whats-better-many-small-tables-or-one-big-table
比如:
![](https://img.haomeiwen.com/i6560153/1526436f240bbbcb.png)
https://en.wikipedia.org/wiki/Database_normalization
"Functional Dependency", "Normalization" and "Database Design"
![](https://img.haomeiwen.com/i6560153/57d15e558a32fbef.png)
Functional Dependency means:
x -> y given any two tuples in table R. 如果他们的x值一样,他们的Y值一定一样!
有时候之所以要拆分Big Table into small table是因为 big table里会有redundancy, waste 空间。
比如说:
![](https://img.haomeiwen.com/i6560153/a0f9f4aebac8fe72.png)
Rating 和 wage 有一种functional dependency. Rating只要是8,wage一定是10。
rating只要是5, wage一定是7. 那么为什么我们还要花space多一个wage column在big table?
更加省空间的做法:
![](https://img.haomeiwen.com/i6560153/5e7e16faa1f5dc15.png)
Decomposition 的时候要非常小心,因为一不注意我们可能导致Lossy, 拆分出的table拼不回原本的table。
![](https://img.haomeiwen.com/i6560153/f51b0a3ccc444f08.png)
A-->B; C-->B 会导致好多种combination 因此lossy...
![](https://img.haomeiwen.com/i6560153/92588dd5ca6dc90b.png)
lossless:
![](https://img.haomeiwen.com/i6560153/d3295ebd4aedf2dd.png)
网友评论