Class CardinalityBasedJoinOrderingBase

java.lang.Object
se.liu.ida.hefquin.engine.queryproc.impl.loptimizer.heuristics.CardinalityBasedJoinOrderingBase
All Implemented Interfaces:
HeuristicForLogicalOptimization
Direct Known Subclasses:
CardinalityBasedJoinOrderingWithRequests

public abstract class CardinalityBasedJoinOrderingBase extends Object implements HeuristicForLogicalOptimization
Base class for heuristics that use cardinality estimates to decide on a join order for the subplans of a multiway join or a binary join. The heuristic is applied recursively to all joins within the given plan. The actual join ordering algorithm implemented in this class is a greedy one. It first determines cardinality estimates for all the subplans of the corresponding join. Given these estimates, the algorithm picks the subplan with the lowest cardinality estimate to become the first plan in the join order. Thereafter, the algorithm performs an iteration where each step picks the next subplan for the join. This decision is based on estimated join cardinalities. However, as candidates to be picked as the next subplan, the algorithm considers only the subplans that have a join variable with the subplans that have already been selected so far, which is done to avoid cross products (unless a cross product is unavoidable). The actual cardinality estimation approach, both for the cardinalities of the subplans and for the join cardinalities, may be different for each subclass.