简体   繁体   English

无损分解

[英]Lossless Decomposition

Consider a schema R(A, B, C, D) and functional dependencies A ⟶ B and C ⟶ D. Then why isn't the decomposition of R into R1(A, B) and R2(C, D) a lossless decomposition? 考虑模式R(A,B,C,D)和函数依赖性A⟶B和C⟶D。那么为什么不将R分解为R1(A,B)和R2(C,D)进行无损分解? Can you please explain with real life example that what info is lost here? 你能用现实生活中的例子解释一下这里丢失了什么信息吗?

You certainly need the two relations R1(A,B) and R2(C, D) that you outline in the lossless decomposition, but you've lost the crucial information about which A values are associated with which C values that was present in the original R(A, B, C, D). 您当然需要在无损分解中概述的两个关系R1(A,B)和R2(C,D),但是您丢失了关于哪些A值与哪些C值相关联的关键信息。原R(A,B,C,D)。 So you also need R3(A, C) to keep all the original information. 因此,您还需要R3(A,C)来保留所有原始信息。

Relation R 关系R.

A    B    C    D
1    2    13   14
2    2    13   14
3    1    12   15

Relation R1 关系R1

A    B
1    2
2    2
3    1

Relation R2 关系R2

C    D
13   14
12   15

Join R1 and R2 (Cartesian product); 加入R1和R2(笛卡尔积); bogus rows marked ☜ 伪造的行标有☜

A    B    C    D
1    2    13   14
1    2    12   15   ☜
2    2    13   14
2    2    12   15   ☜
1    3    13   14   ☜
3    1    12   15

Since this join is not the same as R, the proposed decomposition is not lossless. 由于此连接与R不同,因此建议的分解不是无损的。

Relation R3 关系R3

A   C
1   13
2   13
3   12

Join R1, R2, R3 加入R1,R2,R3

A    B    C    D
1    2    13   14
2    2    13   14
3    1    12   15

Since this result relation is the same as the original R, the decomposition into R1, R2, and R3 is lossless. 由于该结果关系与原始R相同,因此分解为R1,R2和R3是无损的。

Then why isn't the decomposition of R into R1(A, B) and R2(C, D) a lossless decomposition? 那么为什么不将R分解成R1(A,B)和R2(C,D)进行无损分解?

Because now (A,B) and (C,D) are unrelated, which they weren't. 因为现在(A,B)和(C,D)是不相关的,它们不是。 You need also a relation between A and C. 你还需要A和C之间的关系。

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

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