private static void setCardinalityEstimate(PlanNode node, Float bestEstimate, boolean setColEstimates, QueryMetadataInterface metadata) throws QueryMetadataException, TeiidComponentException { setCardinalityEstimate(node, bestEstimate, setColEstimates, metadata, 1, 1); }
private static void setCardinalityEstimate(PlanNode node, Float bestEstimate, boolean setColEstimates, QueryMetadataInterface metadata) throws QueryMetadataException, TeiidComponentException { setCardinalityEstimate(node, bestEstimate, setColEstimates, metadata, 1, 1); }
private static void setCardinalityEstimate(PlanNode node, Float bestEstimate, boolean setColEstimates, QueryMetadataInterface metadata) throws QueryMetadataException, TeiidComponentException { setCardinalityEstimate(node, bestEstimate, setColEstimates, metadata, 1, 1); }
/** * For a Group or Dup Removal node, the cost is basically the smaller of the largest NDV of the * selected columns and cost of the child node (if it is known). * @param node * @param metadata * @throws QueryMetadataException * @throws TeiidComponentException */ private static void estimateNodeCost(PlanNode node, List expressions, QueryMetadataInterface metadata) throws QueryMetadataException, TeiidComponentException { PlanNode child = node.getFirstChild(); float childCost = child.getCardinality(); if(childCost == UNKNOWN_VALUE) { setCardinalityEstimate(node, null, true, metadata); return; } float cardinality = getNDVEstimate(node, metadata, childCost, expressions, true); setCardinalityEstimate(node, cardinality, true, metadata); }
/** * For a Group or Dup Removal node, the cost is basically the smaller of the largest NDV of the * selected columns and cost of the child node (if it is known). * @param node * @param metadata * @throws QueryMetadataException * @throws TeiidComponentException */ private static void estimateNodeCost(PlanNode node, List expressions, QueryMetadataInterface metadata) throws QueryMetadataException, TeiidComponentException { PlanNode child = node.getFirstChild(); float childCost = child.getCardinality(); if(childCost == UNKNOWN_VALUE) { setCardinalityEstimate(node, null, true, metadata); return; } float cardinality = getNDVEstimate(node, metadata, childCost, expressions, true); setCardinalityEstimate(node, cardinality, true, metadata); }
/** * For a Group or Dup Removal node, the cost is basically the smaller of the largest NDV of the * selected columns and cost of the child node (if it is known). * @param node * @param metadata * @throws QueryMetadataException * @throws TeiidComponentException */ private static void estimateNodeCost(PlanNode node, List expressions, QueryMetadataInterface metadata) throws QueryMetadataException, TeiidComponentException { PlanNode child = node.getFirstChild(); float childCost = child.getCardinality(); if(childCost == UNKNOWN_VALUE) { setCardinalityEstimate(node, null, true, metadata); return; } float cardinality = getNDVEstimate(node, metadata, childCost, expressions, true); setCardinalityEstimate(node, cardinality, true, metadata); }
/** * Estimate the cost of a selection. This is not easy to do without information * about the value count for each relation attribute. * @param metadata */ private static void estimateSelectNodeCost(PlanNode node, QueryMetadataInterface metadata) throws QueryMetadataException, TeiidComponentException { PlanNode child = node.getFirstChild(); float childCost = child.getCardinality(); //Get list of conjuncts Criteria selectCriteria = (Criteria)node.getProperty(NodeConstants.Info.SELECT_CRITERIA); float newCost = recursiveEstimateCostOfCriteria(childCost, node, selectCriteria, metadata); setCardinalityEstimate(node, newCost, true, metadata); }
/** * Estimate the cost of a selection. This is not easy to do without information * about the value count for each relation attribute. * @param metadata */ private static void estimateSelectNodeCost(PlanNode node, QueryMetadataInterface metadata) throws QueryMetadataException, TeiidComponentException { PlanNode child = node.getFirstChild(); float childCost = child.getCardinality(); //Get list of conjuncts Criteria selectCriteria = (Criteria)node.getProperty(NodeConstants.Info.SELECT_CRITERIA); float newCost = recursiveEstimateCostOfCriteria(childCost, node, selectCriteria, metadata); setCardinalityEstimate(node, newCost, true, metadata); }
/** * Estimate the cost of a selection. This is not easy to do without information * about the value count for each relation attribute. * @param metadata */ private static void estimateSelectNodeCost(PlanNode node, QueryMetadataInterface metadata) throws QueryMetadataException, TeiidComponentException { PlanNode child = node.getFirstChild(); float childCost = child.getCardinality(); //Get list of conjuncts Criteria selectCriteria = (Criteria)node.getProperty(NodeConstants.Info.SELECT_CRITERIA); float newCost = recursiveEstimateCostOfCriteria(childCost, node, selectCriteria, metadata); setCardinalityEstimate(node, newCost, true, metadata); }
setCardinalityEstimate(node, 1f, true, metadata); } else { estimateNodeCost(node, (List)node.getProperty(NodeConstants.Info.GROUP_COLS), metadata); setCardinalityEstimate(node, childCost, true, metadata); break; setCardinalityEstimate(node, 0f, true, metadata); break; childCost = 1f; setCardinalityEstimate(node, childCost, true, metadata); break; setCardinalityEstimate(node, cost, true, metadata); break;
setCardinalityEstimate(node, 1f, true, metadata); } else { estimateNodeCost(node, (List)node.getProperty(NodeConstants.Info.GROUP_COLS), metadata); setCardinalityEstimate(node, childCost, true, metadata); break; setCardinalityEstimate(node, 0f, true, metadata); break; childCost = 1f; setCardinalityEstimate(node, childCost, true, metadata); break; setCardinalityEstimate(node, cost, true, metadata); break;
setCardinalityEstimate(node, null, true, metadata); return; setCardinalityEstimate(node, cost, true, metadata, leftPercent, rightPercent);
setCardinalityEstimate(node, null, true, metadata); return; setCardinalityEstimate(node, cost, true, metadata, leftPercent, rightPercent);
setCardinalityEstimate(node, null, true, metadata); return; setCardinalityEstimate(node, cost, true, metadata, leftPercent, rightPercent);
private static void estimateSetOpCost(PlanNode node, QueryMetadataInterface metadata) throws QueryMetadataException, TeiidComponentException { float cost = 0; SetQuery.Operation op = (SetQuery.Operation)node.getProperty(NodeConstants.Info.SET_OPERATION); float leftCost = (Float)node.getFirstChild().getProperty(NodeConstants.Info.EST_CARDINALITY); float rightCost = (Float)node.getLastChild().getProperty(NodeConstants.Info.EST_CARDINALITY); if (!node.hasBooleanProperty(NodeConstants.Info.USE_ALL)) { leftCost = getDistinctEstimate(node.getFirstChild(), metadata, leftCost); rightCost = getDistinctEstimate(node.getLastChild(), metadata, rightCost); } cost = getCombinedSetEstimate(op, leftCost, rightCost, !node.hasBooleanProperty(NodeConstants.Info.USE_ALL)); setCardinalityEstimate(node, new Float(cost), true, metadata); }
private static void estimateSetOpCost(PlanNode node, QueryMetadataInterface metadata) throws QueryMetadataException, TeiidComponentException { float cost = 0; SetQuery.Operation op = (SetQuery.Operation)node.getProperty(NodeConstants.Info.SET_OPERATION); float leftCost = (Float)node.getFirstChild().getProperty(NodeConstants.Info.EST_CARDINALITY); float rightCost = (Float)node.getLastChild().getProperty(NodeConstants.Info.EST_CARDINALITY); if (!node.hasBooleanProperty(NodeConstants.Info.USE_ALL)) { leftCost = getDistinctEstimate(node.getFirstChild(), metadata, leftCost); rightCost = getDistinctEstimate(node.getLastChild(), metadata, rightCost); } cost = getCombinedSetEstimate(op, leftCost, rightCost, !node.hasBooleanProperty(NodeConstants.Info.USE_ALL)); setCardinalityEstimate(node, new Float(cost), true, metadata); }
private static void estimateSetOpCost(PlanNode node, QueryMetadataInterface metadata) throws QueryMetadataException, TeiidComponentException { float cost = 0; SetQuery.Operation op = (SetQuery.Operation)node.getProperty(NodeConstants.Info.SET_OPERATION); float leftCost = (Float)node.getFirstChild().getProperty(NodeConstants.Info.EST_CARDINALITY); float rightCost = (Float)node.getLastChild().getProperty(NodeConstants.Info.EST_CARDINALITY); if (!node.hasBooleanProperty(NodeConstants.Info.USE_ALL)) { leftCost = getDistinctEstimate(node.getFirstChild(), metadata, leftCost); rightCost = getDistinctEstimate(node.getLastChild(), metadata, rightCost); } cost = getCombinedSetEstimate(op, leftCost, rightCost, !node.hasBooleanProperty(NodeConstants.Info.USE_ALL)); setCardinalityEstimate(node, new Float(cost), true, metadata); }
setCardinalityEstimate(node, new Float(cost), false, metadata);
setCardinalityEstimate(node, new Float(cost), false, metadata);
setCardinalityEstimate(node, new Float(cost), false, metadata);