简体   繁体   English

无损连接分解不止两个关系

[英]Lossless join decomposition more than two relations

Given a relation, a set of functional dependencies, and it's decomposition into multiple relations (> 2) , is there some method with which to check if this decomposition is lossless or lossy? 给定一个关系,一组功能依赖项,并将其分解为多个关系(> 2),是否有某种方法可以检查这种分解是无损的还是有损的?

For decomposing R into two relations R1 and R2, we check if the intersection of R1 and R2 forms the primary key of either R1 or R2. 为了将R分解为两个关系R1和R2,我们检查R1和R2的交点是否形成R1或R2的主键。 If it does, then the decomposition is lossless. 如果是这样,则分解是无损的。

Consider the question below, where a relation R,it's FD set and decomposition are given. 考虑下面的问题,给出关系R的FD集和分解。

在此处输入图片说明

Now, I think this decomposition is lossy...but it's more of an intuition. 现在,我认为这种分解是有损的……但是,这更像是一种直觉。 If I am asked to prove this, I might not be able to. 如果要求我证明这一点,我可能无法做到。 My intuition is based on the fact that the relation pairs R2-R3 , R1-R2 , R1-R4 don't have a common attribute between them, which is prime in either relation of the pair. 我的直觉是基于这样的事实,即关系对R2-R3,R1-R2和R1-R4之间没有共同的属性,这在该对关系中是首要的。 So a natural join operation across R1, R2, R3 and R4 will produce some rows which were not in the original relation. 因此,跨R1,R2,R3和R4的自然联接操作将产生一些不在原始关系中的行。

But I myself am not sure if this decomposition is lossy or not.. Can someone please help me understand this? 但是我自己不确定这种分解是否有损。有人可以帮助我理解这一点吗?

Thanks! 谢谢!

Similar question with a good answer is found here: Lossless Join and Decomposition From Functional Dependencies . 在这里可以找到类似的问题,并且给出了很好的答案: 无损连接和功能依赖关系的分解 Just use the chase/tableau method (: 只需使用chase / tableau方法(:

A binary decomposition is lossless when the common columns are a superkey of one component, ie include a CK (candidate key) of one component. 当公用列是一个组件的超键,即包括一个组件的CK(候选键)时,二进制分解是无损的。 (Not a "prime attribute", ie one that is a member of a CK.) So the following are lossless: (不是“主要属性”,即是CK成员的属性。)因此,以下内容是无损的:

       join        FDs                        CKs
R1 R3  ABCDH       A->B, A->C, D->H, AH->D    AD, AH
R2 R4  CDEH        E->C, D->EH                D
R4 R3  ADEH        D->EH, AH->D               AD, AH

We can now join ABCDH & ADEH losslessly based on either CK of either relation, then join the result with CDEH losslessly based on CK D. 现在,我们可以基于任一关系的CK无损地加入ABCDH&ADEH,然后根据CK D无损地将结果与CDEH相结合。

So the decomposition is lossless. 因此,分解是无损的。

Alternatively we can try decomposing. 或者,我们可以尝试分解。 Try R = R1 JOIN ADEH. 尝试R = R1 JOIN ADEH。 We find ADEH's FDs & CKs (which happen to be in the table above). 我们找到ADEH的FD和CK(恰好在上表中)。 We continue, to see whether we can keep losslessly decompose to get R2, R3 & R4. 我们继续观察是否可以继续无损分解以获得R2,R3和R4。

For a general algorithm see the Chase . 有关常规算法,请参阅Chase

According to me the decomposition is lossless. 根据我的说法,分解是无损的。 If you go with the tables, R1 intersection R3 and R2 intersection R4, it is lossless & it involves all the decomposed tables also. 如果使用表格,R1交叉点R3和R2交叉点R4,它是无损的,并且还涉及所有分解的表格。 If you go for natural join between R1 & R3 and R2 & R4, you will get back the table R. thanks.. 如果您想在R1和R3与R2和R4之间进行自然连接,您将获得表R。谢谢。

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

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