Professional Documents
Culture Documents
as follows:
PROJ1 = σPNO ≤ ’P2’(PROJ)
PROJ2 = σPNO > ’P2’(PROJ)
Transform the following query into a reduced query on fragments:
select ENO, PNAME
from PROJ, ASG
where PROJ.PNO = ASG.PNO
and PNO = ‘P4’
Solution
The general query on fragments is:
UNION
ENO, PNAME
PNO=”P4”
PNO PNO
The sub-trees that produce an empty relation can be removed. This process is called the
query reduction. In this case, the PROJ1 doesn’t have any records with PNO=”P4” based
on the fragmentation rule. Hence, the join of PROJ1 and ASG would return an empty
set. Therefore, we eliminate the left subtree.
Based on the fragmentation rule, PROJ2 may have records with PNO=”P4”. In that case,
the join with ASG would not return an empty set. Therefore, that subtree remains.
Because we have only one subtree left, the union operation is also eliminated. The
reduced subtree is:
ENO, PNAME
PNO=”P4”
PNO
PROJ2 ASG
The Budget attribute is in the project relation, and the query doesn’t select any attributes
from the ASG relation. We have a useless join that needs to be eliminated.
ENO, PNAME
PNO=”P4”
PROJ2