org.exist.xquery
Class Optimizer
java.lang.Object
org.exist.xquery.BasicExpressionVisitor
org.exist.xquery.DefaultExpressionVisitor
org.exist.xquery.Optimizer
- All Implemented Interfaces:
- ExpressionVisitor
public class Optimizer
- extends DefaultExpressionVisitor
Analyzes the query and marks optimizable expressions for the query engine.
This class just searches for potentially optimizable expressions in the query tree and
encloses those expressions with an (#exist:optimize#) pragma. The real optimization
work is not done by this class but by the pragma (see Optimize
).
The pragma may also decide that the optimization is not applicable and just execute
the expression without any optimization.
Currently, the optimizer is disabled by default. To enable it, set attribute enable-query-rewriting
to yes in conf.xml:
<xquery enable-java-binding="no" enable-query-rewriting="yes">...
To enable/disable the optimizer for a single query, use an option:
declare option exist:optimize "enable=yes|no";
Optimizer
public Optimizer(XQueryContext context)
hasOptimized
public boolean hasOptimized()
visitLocationStep
public void visitLocationStep(LocationStep locationStep)
- Description copied from interface:
ExpressionVisitor
- Found a LocationStep
- Specified by:
visitLocationStep
in interface ExpressionVisitor
- Overrides:
visitLocationStep
in class DefaultExpressionVisitor
visitFilteredExpr
public void visitFilteredExpr(FilteredExpression filtered)
- Specified by:
visitFilteredExpr
in interface ExpressionVisitor
- Overrides:
visitFilteredExpr
in class BasicExpressionVisitor
visitAndExpr
public void visitAndExpr(OpAnd and)
- Specified by:
visitAndExpr
in interface ExpressionVisitor
- Overrides:
visitAndExpr
in class BasicExpressionVisitor
visitPredicate
public void visitPredicate(Predicate predicate)
- Specified by:
visitPredicate
in interface ExpressionVisitor
- Overrides:
visitPredicate
in class DefaultExpressionVisitor
Copyright (C) Wolfgang Meier. All rights reserved.