SQL里大表和小表问题

2020-03-08  本文已影响0人  98Future

https://stackoverflow.com/questions/4089830/whats-better-many-small-tables-or-one-big-table

比如:

https://en.wikipedia.org/wiki/Database_normalization

"Functional Dependency", "Normalization" and "Database Design"

Functional Dependency means:

x -> y  given any two tuples in table R. 如果他们的x值一样,他们的Y值一定一样!

有时候之所以要拆分Big Table into small table是因为 big table里会有redundancy, waste 空间。

比如说:

Rating 和 wage 有一种functional dependency. Rating只要是8,wage一定是10。

rating只要是5, wage一定是7. 那么为什么我们还要花space多一个wage column在big table?

更加省空间的做法:

Decomposition 的时候要非常小心,因为一不注意我们可能导致Lossy, 拆分出的table拼不回原本的table。

A-->B; C-->B  会导致好多种combination 因此lossy...

lossless:

上一篇下一篇

猜你喜欢

热点阅读