Search in sources :

Example 1 with PlanItem

use of com.wplatform.ddal.dbobject.table.PlanItem in project jdbc-shards by wplatform.

the class Update method prepare.

@Override
public void prepare() {
    if (condition != null) {
        condition.mapColumns(tableFilter, 0);
        condition = condition.optimize(session);
        condition.createIndexConditions(session, tableFilter);
    }
    for (int i = 0, size = columns.size(); i < size; i++) {
        Column c = columns.get(i);
        Expression e = expressionMap.get(c);
        e.mapColumns(tableFilter, 0);
        expressionMap.put(c, e.optimize(session));
    }
    PlanItem item = tableFilter.getBestPlanItem(session, 1);
    tableFilter.setPlanItem(item);
    tableFilter.prepare();
}
Also used : Column(com.wplatform.ddal.dbobject.table.Column) ValueExpression(com.wplatform.ddal.command.expression.ValueExpression) Expression(com.wplatform.ddal.command.expression.Expression) PlanItem(com.wplatform.ddal.dbobject.table.PlanItem)

Example 2 with PlanItem

use of com.wplatform.ddal.dbobject.table.PlanItem in project jdbc-shards by wplatform.

the class Delete method prepare.

@Override
public void prepare() {
    if (condition != null) {
        condition.mapColumns(tableFilter, 0);
        condition = condition.optimize(session);
        condition.createIndexConditions(session, tableFilter);
    }
    PlanItem item = tableFilter.getBestPlanItem(session, 1);
    tableFilter.setPlanItem(item);
    tableFilter.prepare();
}
Also used : PlanItem(com.wplatform.ddal.dbobject.table.PlanItem)

Example 3 with PlanItem

use of com.wplatform.ddal.dbobject.table.PlanItem in project jdbc-shards by wplatform.

the class Optimizer method optimize.

/**
     * Calculate the best query plan to use.
     */
void optimize() {
    calculateBestPlan();
    bestPlan.removeUnusableIndexConditions();
    TableFilter[] f2 = bestPlan.getFilters();
    topFilter = f2[0];
    for (int i = 0; i < f2.length - 1; i++) {
        f2[i].addJoin(f2[i + 1], false, false, null);
    }
    for (TableFilter f : f2) {
        PlanItem item = bestPlan.getItem(f);
        f.setPlanItem(item);
    }
}
Also used : TableFilter(com.wplatform.ddal.dbobject.table.TableFilter) PlanItem(com.wplatform.ddal.dbobject.table.PlanItem)

Aggregations

PlanItem (com.wplatform.ddal.dbobject.table.PlanItem)3 Expression (com.wplatform.ddal.command.expression.Expression)1 ValueExpression (com.wplatform.ddal.command.expression.ValueExpression)1 Column (com.wplatform.ddal.dbobject.table.Column)1 TableFilter (com.wplatform.ddal.dbobject.table.TableFilter)1