Assume that we have an SqL query containing joins and a group-by. The standard way of evaluating this type of query is to first perform all the joins and then the group-by operation. However, it may be possible to perform the group-by early, that is, to push the groupby operation past one or more joins. Early grouping may reduce the query processing cost by reducing the amount of data participating in joins. We formally define the problem, adhering strictly to the semantics of NULL and duplicate elimination in SqLQ and prove necessary and suficient conditions for deciding when this transfownation is valid. In practice, it may be ezpensive OT even impossible to test whether the conditions are satisfied. Therefore, we also present a more practical algorithm that tests a simpler, suficient condition. This algorithm is fast and detects a large subclass of transformable queries.
[1]
Werner Kießling.
On Semantic Reefs and Efficient Processing of Correlation Queries with Aggregates
,
1985,
VLDB.
[2]
Won Kim,et al.
On optimizing an SQL-like nested query
,
1982,
TODS.
[3]
Günter von Bültzingsloewen.
Translating and Optimizing SQL Queries Having Aggregates
,
1987,
VLDB.
[4]
Anthony C. Klug.
Access paths in the "Abe" statistical query facility
,
1982,
SIGMOD '82.
[5]
Alan R. Simon,et al.
Understanding the New SQL: A Complete Guide
,
1993
.
[6]
Giuseppe Pelagatti,et al.
Formal semantics of SQL queries
,
1991,
TODS.