Interchanging the order of grouping and join
| dc.contributor.author | Yan, Weipeng P. | |
| dc.contributor.author | Larson, Per-Ake | |
| dc.date.accessioned | 2026-11-24T21:06:34Z | |
| dc.date.issued | 1995-02 | |
| dc.description.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. | |
| dc.identifier.uri | https://hdl.handle.net/10012/24752 | |
| dc.language.iso | en | |
| dc.publisher | University of Waterloo | |
| dc.relation.ispartofseries | Computer Science Technical Reports; CS-95-09 | |
| dc.title | Interchanging the order of grouping and join | |
| dc.type | Technical Report | |
| uws.contributor.affiliation1 | Faculty of Mathematics | |
| uws.contributor.affiliation2 | David R. Cheriton School of Computer Science | |
| uws.peerReviewStatus | Unreviewed | |
| uws.scholarLevel | Faculty | |
| uws.typeOfResource | Text | en |