Package org.apache.derby.iapi.sql.compile

Examples of org.apache.derby.iapi.sql.compile.Optimizable


    JBitSet outerTables = new JBitSet(numOptimizables);

    /* Modify the access path of each table, as necessary */
    for (int ictr = 0; ictr < numOptimizables; ictr++)
    {
      Optimizable optimizable = optimizableList.getOptimizable(ictr);

      /* Current table is treated as an outer table */
      outerTables.or(optimizable.getReferencedTableMap());

      /*
      ** Push any appropriate predicates from this optimizer's list
      ** to the optimizable, as appropriate.
      */
      pushPredicates(optimizable, outerTables);

      optimizableList.setOptimizable(
        ictr,
        optimizable.modifyAccessPath(outerTables));
    }
  }
View Full Code Here


           */
          for (int i=0; i < optimizableList.size(); i++)
          {
            //Get one outer optimizable at a time from the join
            //order
            Optimizable considerOptimizable =
              optimizableList.getOptimizable(i);
            //If we have come across the optimizable for the order
            //by column in the join order, then we do not need to
            //look at the inner optimizables in the join order. As
            //long as the outer optimizables are one row resultset,
            //we are fine to consider sort avoidance.
            if (considerOptimizable.getTableNumber() ==
              cr.getTableNumber())
              break;
            /*
             * The following if condition is checking if the
             * outer optimizable to the order by column's
             * optimizable is one row resultset or not.
             *
             * If the outer optimizable is one row resultset,
             * then move on to the next optimizable in the join
             * order and do the same check on that optimizable.
             * Continue this  until we are done checking that all
             * the outer optimizables in the join order are single
             * row resultsets. If we run into an outer optimizable
             * which is not one row resultset, then we can not
             * consider sort avoidance for the query.
             */
            if (rowOrdering.alwaysOrdered(
                considerOptimizable.getTableNumber()))
              continue;
            else
              //This outer optimizable can return more than
              //one row. Because of this, we can't avoid the
              //sorting for this query.
View Full Code Here

   *
   * @exception StandardException    Thrown on error
   */
  public Optimizable modifyAccessPath(JBitSet outerTables) throws StandardException
  {
    Optimizable retOptimizable;
    retOptimizable = super.modifyAccessPath(outerTables);

    /* We only want call addNewNodes() once */
    if (addNewNodesCalled)
    {
View Full Code Here

   *
   * @exception StandardException    Thrown on error
   */
  public Optimizable modifyAccessPath(JBitSet outerTables) throws StandardException
  {
    Optimizable retOptimizable;
    retOptimizable = super.modifyAccessPath(outerTables);

    /* We only want call addNewNodes() once */
    if (addNewNodesCalled)
    {
View Full Code Here

          "Modifying access paths using optimizer " + this.hashCode();
        break;

      case SHORT_CIRCUITING:
        String basis = (timeExceeded) ? "time exceeded" : "cost";
        Optimizable thisOpt =
          optimizableList.getOptimizable(
                    proposedJoinOrder[joinPosition]);
        if (thisOpt.getBestAccessPath().getCostEstimate() == null)
          basis = "no best plan found";
        traceString =
          "Short circuiting based on " + basis +
          " at join position " + joinPosition;
        break;
View Full Code Here

     * because a predicate's referencedTableMap references the table number
     * of the ProjectRestrictiveNode.  And we need this info to see if
     * a predicate is in storeRestrictionList that can be pushed down.
     * Beetle 3458.
     */
    Optimizable hashTableFor = innerTable;
    if (innerTable instanceof ProjectRestrictNode)
    {
      ProjectRestrictNode prn = (ProjectRestrictNode) innerTable;
      if (prn.getChildResult() instanceof Optimizable)
        hashTableFor = (Optimizable) (prn.getChildResult());
View Full Code Here

  /** @see RowOrdering#alwaysOrdered */
  public boolean alwaysOrdered(int tableNumber)
  {
        Iterator<Optimizable> it = alwaysOrderedOptimizables.iterator();
        while (it.hasNext()) {
            Optimizable optTable = it.next();

            if (optTable.hasTableNumber()) {
                if (optTable.getTableNumber() == tableNumber) {
                    return true;
                }
            }
        }

View Full Code Here

  {
        ListIterator<Optimizable> it = list.listIterator();

        while (it.hasNext())
    {
            Optimizable optTable = it.next();

            if (optTable.hasTableNumber()
                    && (optTable.getTableNumber() == tableNumber)) {
                it.remove();
            }
    }
  }
View Full Code Here

      retval = "Unordered optimizables: ";

      for (i = 0; i < unorderedOptimizables.size(); i++)
      {
                Optimizable opt = unorderedOptimizables.get(i);
        if (opt.getBaseTableName() != null)
        {
          retval += opt.getBaseTableName();
        }
        else
        {
          retval += unorderedOptimizables.get(i).toString();
        }
        retval += " ";
      }
      retval += "\n";

      retval += "\nAlways ordered optimizables: ";

      for (i = 0; i < alwaysOrderedOptimizables.size(); i++)
      {
        Optimizable opt = alwaysOrderedOptimizables.get(i);
        if (opt.getBaseTableName() != null)
        {
          retval += opt.getBaseTableName();
        }
        else
        {
          retval += alwaysOrderedOptimizables.get(i).toString();
        }
View Full Code Here

   */
  private boolean unorderedOptimizablesOtherThan(Optimizable optimizable)
  {
    for (int i = 0; i < unorderedOptimizables.size(); i++)
    {
      Optimizable thisOpt =
        unorderedOptimizables.get(i);

      if (thisOpt != optimizable)
        return true;
    }
View Full Code Here

TOP

Related Classes of org.apache.derby.iapi.sql.compile.Optimizable

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.