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

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


   * @exception StandardException    Thrown on error
   */
    @Override
  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
   */
    @Override
  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

        if ( optimizableList != null )
        {
            for ( int i = 0; i < optimizableList.size(); i++ )
            {
                Optimizable opt = optimizableList.getOptimizable( i );

                if ( _cm == null )
                {
                    _cm = ((QueryTreeNode) opt).getContextManager();
                    _lcc = (LanguageConnectionContext) _cm.getContext( LanguageConnectionContext.CONTEXT_ID );
                }
               
                Element optElement = createElement
                    ( queryElement, QBLOCK_OPTIMIZABLE, getOptimizableName( opt ).getFullSQLName() );
                optElement.setAttribute( QBLOCK_OPT_TABLE_NUMBER, Integer.toString( opt.getTableNumber() ) );
            }
        }
    }
View Full Code Here

   
    public  void    traceShortCircuiting( boolean timeExceeded, Optimizable thisOpt, int joinPosition ) {}
   
    public  void    traceSkippingJoinOrder( int nextOptimizable, int joinPosition, int[] proposedJoinOrder, JBitSet assignedTableMap )
    {
        Optimizable opt = _currentQueryBlock.optimizableList.getOptimizable( nextOptimizable );

        Element skip = formatSkip
            (
             _currentQueryBlock.queryBlockElement, QBLOCK_SKIP,
             "Useless join order. " + getOptimizableName( opt ).getFullSQLName() + " depends on tables after it in the join order"
View Full Code Here

    public  void    traceRememberingBestAccessPath( AccessPath accessPath, int tableNumber, int planType ) {}
    public  void    traceNoMoreConglomerates( int tableNumber ) {}
   
    public  void    traceConsideringConglomerate( ConglomerateDescriptor cd, int tableNumber )
    {
        Optimizable opt = getOptimizable( tableNumber );
       
        _currentQueryBlock.currentDecoration = createElement( _currentQueryBlock.currentJoinsElement, DECORATION, null );

        _currentQueryBlock.currentDecoration.setAttribute( DECORATION_CONGLOM_NAME, cd.getConglomerateName() );
        _currentQueryBlock.currentDecoration.setAttribute( DECORATION_TABLE_NAME, getOptimizableName( opt ).toString() );
View Full Code Here

    /** Get the Optimizable with the given tableNumber */
    private Optimizable getOptimizable( int tableNumber )
    {
        for ( int i = 0; i < _currentQueryBlock.optimizableList.size(); i++ )
        {
            Optimizable candidate = _currentQueryBlock.optimizableList.getOptimizable( i );
           
            if ( tableNumber == candidate.getTableNumber() )    { return candidate; }
        }

        return null;
    }
View Full Code Here

            for ( int idx = 0; idx < proposedJoinOrder.length; idx++ )
            {
                int     optimizableNumber = proposedJoinOrder[ idx ];
                if ( optimizableNumber >= 0 )
                {
                    Optimizable optimizable = _currentQueryBlock.optimizableList.getOptimizable( optimizableNumber );
                    createElement( parent, JO_SLOT, getOptimizableName( optimizable ).getFullSQLName() );
                }
            }
        }
    }
View Full Code Here

                    // should never happen!
                    buffer.append( "{ UNKNOWN LIST INDEX " + listIndex + " } " );
                    continue;
                }

                Optimizable optimizable = _currentQueryBlock.optimizableList.getOptimizable( listIndex );
           
                AccessPath  ap = avoidSort ?
                    optimizable.getBestSortAvoidancePath() : optimizable.getBestAccessPath();
                JoinStrategy    js = ap.getJoinStrategy();
                UniqueTupleDescriptor   utd = OptimizerImpl.isTableFunction( optimizable ) ?
                    ((StaticMethodCallNode) ((FromVTI) ((ProjectRestrictNode) optimizable).getChildResult()).getMethodCall()).ad :
                    ap.getConglomerateDescriptor();
View Full Code Here

                            proposedJoinOrder[i] != -1; // -1: partial order
                        i++)
          {
                       // Get one outer optimizable at a time from the join
                       // order
                        Optimizable considerOptimizable = optimizableList.
                                getOptimizable(proposedJoinOrder[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, or is ordered on the order by column (see
                       // below check), 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

    ** is presumed to be correlated.
    */
    nonCorrelatedTableMap = new JBitSet(numTablesInQuery);
    for (int tabCtr = 0; tabCtr < numOptimizables; tabCtr++)
    {
      Optimizable  curTable = optimizableList.getOptimizable(tabCtr);
      nonCorrelatedTableMap.or(curTable.getReferencedTableMap());
    }

    /* Get the time that optimization starts */
    timeOptimizationStarted = System.currentTimeMillis();
    reloadBestPlan = false;
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.