Class ProjectRemoval

java.lang.Object
se.liu.ida.hefquin.engine.queryproc.impl.loptimizer.heuristics.ProjectRemoval
All Implemented Interfaces:
HeuristicForLogicalOptimization

public class ProjectRemoval extends Object implements HeuristicForLogicalOptimization
A heuristic that removes project operators for which the mayReduce flag is not set.

This heuristic is meant to be applied after ProjectPushDown which aims to push projections as far down in the plan as possible and, in this process, may leave several project operators all over the plan. Such operators are unnecessary when they do not contribute to duplicate reduction. Therefore, this heuristic removes project operators with mayReduce = false, while retaining those with mayReduce = true.

More background: Pushing down project operators is useful for two reasons:

  1. If a projection ends up being pushed down all the way into a request operator, this request operator retrieves less data.
  2. If the query uses SELECT DISTINCT, duplicate removal through our mayReduce flags may become more effective in some cases if there are project operators in the plan that project away unnecessary variables early.
Notice that, in the context of the first of these reasons, project operators have no use once projection push down has been completed; they are more like an intermediate artifacts of the project push down process. Yet, keeping them can be useful for the second of the reasons mentioned above. However, if the query does not use DISTINCT, then the second reason is irrelevant; in this case, the project operators should be removed after project push down has been completed.