Interchanging the order of grouping and join

Loading...
Thumbnail Image

Journal Title

Journal ISSN

Volume Title

Publisher

University of Waterloo

Abstract

Assume that we have an SQL query containing joins, a GROUP-BY and possibly a HAVING predicate. The standard way of evaluating this type of query is to first perform the group-by early, that is to push the group-by operation past one or more joins. This may reduce the query processing cost by reducing the amount of data participating in joins. The reverse transformation, i.e., performing join before group-by, can also be beneficial because the join may greatly reduce the input to the group-by. We formally define the problem, adhering strictly to the semantics of SQL2, and prove necessary and sufficient conditions for deciding when the transformation is valid. In practice, it may be expensive or even impossible to test whether the conditions are satisfied. Therefore, we also present a more practical algorithm that tests a simpler, sufficient conditino. This algorithm is fast and detects a large subclass of transformable queries.

Description

Keywords

Citation

Endorsement

Review

Supplemented By

Referenced By