简体   繁体   English

依赖保留

[英]Dependency preserving

So I am looking over my database notes and material trying to refresh myself on the general concepts and terminology for upcoming interviews. 因此,我正在查看我的数据库备注和材料,试图让自己了解即将采访的一般概念和术语。 I have gotten stuck at dependency however and lossless-join decompositions though. 然而,我已经陷入了依赖,然而无损连接分解。 I have searched all over and see lots of mathy equations but I am looking for a plain and simple English response or example. 我已经搜遍了所有并且看到了许多mathy方程式,但我正在寻找一个简单而简单的英语响应或示例。

I have a found a powerpoint from http://www.cs.kent.edu/~jin/DM09Fall/lecture6.ppt which illustrates an example that I cannot fully understand. 我从http://www.cs.kent.edu/~jin/DM09Fall/lecture6.ppt找到了一个powerpoint,它说明了一个我无法完全理解的例子。 It is posted below. 它发布在下面。

R = (A, B, C)F = {A → B, B → C)
Can be decomposed in two different ways
R1 = (A, B),   R2 = (B, C)
Lossless-join decomposition:
         R1 ∩ R2 = {B} and B → BC
Dependency preserving
R1 = (A, B),   R2 = (A, C)
Lossless-join decomposition:
         R1 ∩ R2 = {A} and A → AB
Not dependency preserving (cannot check B -> C without computing R1 ⋈ R2)

So I understand that having A → B and B → C means that you have a "reference" in each other, whereas A → B and A → C means there is no reference or link between B and C. 所以我理解A→B和B→C意味着你们彼此有“参考”,而A→B和A→C意味着B和C之间没有参考或联系。

So, 所以,

  1. Does Lossless-join decomposition mean that the data overall is still intact? Lossless-join分解是否意味着整体数据仍然完好无损? In both scenarios, you can still eventually get both data, right? 在这两种情况下,您仍然可以最终获得两种数据,对吧? If this is wrong, please correct me! 如果这是错的,请纠正我! :) :)

  2. What is the significance of having that connection B to C in the second decomposition, and how does that make it not dependency preserving? 在第二次分解中将连接B设置为C有什么意义,这又如何使它不依赖于保留?

    • If A is deleted you will simply have B and C with no relations. 如果A被删除,你将只有B和C没有关系。

    • If B is deleted you will still have A → C. 如果B被删除,你仍然会有A→C。

    • If C is deleted you will still have A → B. 如果删除C,您仍然会有A→B。

Because even in the first example you will still end up with similiar results upon deleting values. 因为即使在第一个示例中,在删除值时仍然会得到类似的结果。

  • If A is deleted you will still have a relation of B → C. 如果A被删除,您仍然会有B→C的关系。

    • If B is deleted you will simply have A and C with no relations. 如果B被删除,你将只有A和C没有关系。

    • If C is deleted you will have a relation of A → B. 如果删除C,您将具有A→B的关系。

So either way, if you delete each item you will still have two instances of a relation and one instance of two items having no relations 所以无论哪种方式,如果你删除每个项目,你仍然会有两个关系实例和一个没有关系的两个项目的实例

My guess would be that in deleting the "middle man relation" (is there a term for that), B in example 1 and A in example 2, is that you can still relate example 1's A → B then B → C, while in example 2 you are stuck with A → B with no connection to A → C. 我的猜测是删除“中间人关系”(有一个术语),例1中的B和例2中的A,你仍然可以将例子1的A→B与B→C联系起来,而在例2你被困在A→B而没有连接到A→C。

But as you can see I am now back to square one as to why this causes data dependency and while googling "what is data dependency" or "examples of data dependency" it is simply not making any sense to me. 但正如你所看到的那样,我现在回到原点,为什么这会导致数据依赖性,而在谷歌搜索“什么是数据依赖”或“数据依赖的例子”时,它对我来说根本没有任何意义。

If anyone could help clarify this for me it would be greatly appreciated. 如果有人能帮我澄清这一点,我将不胜感激。

Decomposition of a relation R into R1 and R2 is Lossless join decomposition if you can construct back R by joining the relation R1 and R2(form R1 ⋈ R2 you can obtain R). 将关系R分解为R1和R2是无损连接分解,如果你可以通过连接关系R1和R2来构造R(形成R1⋈R2你可以得到R)。

For a decomposition of Relation R into R1 and R2 to be lossless, it must satisfy any of 2 condition: 为了将关系R分解为R1和R2无损,它必须满足以下任何一个条件:

 1. R1 ∩ R2 -> R1
 2. R1 ∩ R2 -> R2

If the above relation doesn't make any sense then think of it like this, when you are intersecting 2 relation R1 and R2 and obtaining common attributes then if the common attributes are able to determine any one of the relation then this (these) common attribute(s) is (are) candidate key(s) for the obtained relation(think why ?) and hence you can join using this candidate key the other relation to obtain R. 如果上述关系没有任何意义,那么可以这样想,当你将两个关系R1和R2相交并获得公共属性时,如果公共属性能够确定任何一个关系那么这(这些)常见属性是获得的关系的候选关键字(想想为什么?)因此你可以使用这个候选关键字加入另一个关系来获得R.

Regarding dependency preserving, a decomposition of relation R is dependency preserving if the Functional dependency of R can be obtained by taking the union of the functional dependency of all the decomposed relation. 关于依赖性保留,如果可以通过采用所有分解关系的函数依赖性的并集来获得R的函数依赖性,则关系R的分解是依赖性保留。

Lossless Join doesn't mean that any of the tuples are lost, or cannot be recovered after a join. 无损连接并不意味着任何元组丢失,或者在连接后无法恢复。 Lossless join means generation of spurious tuples which lead to "extra" rows (tuples) and "information" is said to be lost. 无损连接意味着产生虚假元组,导致“额外”行(元组)和“信息”被认为丢失。

Putting it simply I think dependency is preserved when we find both sides of the FD in the attributes of one sub-schema. 简单地说,当我们在一个子模式的属性中找到FD的两侧时,我认为依赖性得以保留。 (someone please correct me if I'm wrong). (如果我错了,请有人纠正我)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM