next up previous contents
Next: SQL Up: Stages of Translation Previous: Second Optimisation (OP2)

Third Optimisation (OP3)

 

Although these expressions represent improvements, there is still more that can be done in order to produce compact queries. If we look at the optimised clause set associated with the last example in the section on the second optimisation (above), we can see that the third of the clauses equates the key fields of tuples (name is the key field of emp, with t3 and fva both ranging over loc). Since key fields must be unique in relational systems, we know that these tuples must in fact be the same. This allows us to optimise the clause set further, that is, we can obtain:

This can in turn be reconstructed to produce the TRC expression:

which represents another improvement.



Chris Fox, September 1995