|
|
|
|
|
by LaPrometheus
3250 days ago
|
|
Exactly, SQL minimization is a real problem. While there is no canonical form of all SQL in general, it is still possible to reduce Query. There is some existing work. You might want to look at this one:
https://pdfs.semanticscholar.org/c243/25d76c3ba91388e16085c1... One problem is that bag semantic chase is very complicated to implement. We are actually working on a new chase algorithm on our SQL formalization right now. |
|
Take this query:
With a foreign key on customer(address_id), the above JOIN can easily be proven useless, and thus eliminated. Furthermore, take this query: In this case, we don't even need the foreign key as long as there is a unique constraint on address(address_id).