|
|||||||||
| Home >> All >> org >> apache >> derby >> iapi >> sql >> [ compile overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.apache.derby.iapi.sql.compile
Interface OptimizablePredicateList

- public interface OptimizablePredicateList
OptimizablePredicateList provides services for optimizing a table in a query. RESOLVE - the methods for this interface need to get defined.
| Method Summary | |
void |
addOptPredicate(OptimizablePredicate optPredicate)
Add the given OptimizablePredicate to the end of this list. |
void |
classify(Optimizable optTable,
org.apache.derby.iapi.sql.dictionary.ConglomerateDescriptor cd)
Classify the predicates in this list according to the given table and conglomerate. |
void |
copyPredicatesToOtherList(OptimizablePredicateList otherList)
Non-destructive copy of all of the predicates from this list to the other list. |
void |
generateQualifiers(ExpressionClassBuilderInterface acb,
org.apache.derby.iapi.services.compiler.MethodBuilder mb,
Optimizable optTable,
boolean absolute)
Generate the qualifiers for a scan. |
void |
generateStartKey(ExpressionClassBuilderInterface acb,
org.apache.derby.iapi.services.compiler.MethodBuilder mb,
Optimizable optTable)
Generate the start key for a heap or index scan. |
void |
generateStopKey(ExpressionClassBuilderInterface acb,
org.apache.derby.iapi.services.compiler.MethodBuilder mb,
Optimizable optTable)
Generate the stop key for a heap or index scan. |
OptimizablePredicate |
getOptPredicate(int n)
Return the nth OptimizablePredicate in the list. |
boolean |
hasOptimizableEqualityPredicate(Optimizable optTable,
int columnNumber,
boolean isNullOkay)
Is there an optimizable equality predicate on the specified column? |
boolean |
hasOptimizableEquijoin(Optimizable optTable,
int columnNumber)
Is there an optimizable equijoin on the specified column? |
boolean |
isRedundantPredicate(int predNum)
Return whether or not the specified entry in the list is a redundant predicate. |
void |
markAllPredicatesQualifiers()
Mark all of the predicates as Qualifiers and set the numberOfQualifiers to reflect this. |
void |
pushUsefulPredicates(Optimizable optTable)
Determine which predicates in this list are useful for limiting the scan on the given table using its best conglomerate. |
void |
putOptimizableEqualityPredicateFirst(Optimizable optTable,
int columnNumber)
Find the optimizable equality predicate on the specified column and make it the first predicate in this list. |
void |
removeOptPredicate(int predCtr)
Remove the OptimizablePredicate at the specified index (0-based) from the list. |
boolean |
sameStartStopPosition()
Can we use the same key for both the start and stop key. |
double |
selectivity(Optimizable optTable)
calculate the selectivity for a set of predicates. |
void |
setPredicatesAndProperties(OptimizablePredicateList otherList)
Sets the given list to have the same elements as this one, and the same properties as this one (number of qualifiers and start and stop predicates. |
int |
size()
Return the number of OptimizablePredicates in the list. |
int |
startOperator(Optimizable optTable)
Get the start operator for the given Optimizable for a heap or index scan. |
int |
stopOperator(Optimizable optTable)
Get the stop operator for the given Optimizable for a heap or index scan. |
void |
transferAllPredicates(OptimizablePredicateList otherList)
Transfer all the predicates from this list to the given list. |
void |
transferPredicates(OptimizablePredicateList otherList,
org.apache.derby.iapi.util.JBitSet referencedTableMap,
Optimizable table)
Transfer the predicates whose referenced set is contained by the specified referencedTableMap from this list to the other list. |
boolean |
useful(Optimizable optTable,
org.apache.derby.iapi.sql.dictionary.ConglomerateDescriptor cd)
Return true if this predicate list is useful for limiting the scan on the given table using the given conglomerate. |
| Method Detail |
size
public int size()
- Return the number of OptimizablePredicates in the list.
getOptPredicate
public OptimizablePredicate getOptPredicate(int n)
- Return the nth OptimizablePredicate in the list.
removeOptPredicate
public void removeOptPredicate(int predCtr)
throws org.apache.derby.iapi.error.StandardException
- Remove the OptimizablePredicate at the specified index (0-based) from the list.
addOptPredicate
public void addOptPredicate(OptimizablePredicate optPredicate)
- Add the given OptimizablePredicate to the end of this list.
useful
public boolean useful(Optimizable optTable, org.apache.derby.iapi.sql.dictionary.ConglomerateDescriptor cd) throws org.apache.derby.iapi.error.StandardException
- Return true if this predicate list is useful for limiting the scan on
the given table using the given conglomerate.
pushUsefulPredicates
public void pushUsefulPredicates(Optimizable optTable) throws org.apache.derby.iapi.error.StandardException
- Determine which predicates in this list are useful for limiting
the scan on the given table using its best conglomerate. Remove
those predicates from this list and push them down to the given
Optimizable table. The predicates are pushed down in the order of
the index columns that they qualify. Also, the predicates are
"marked" as start predicates, stop predicates, or qualifier
predicates. Finally, the start and stop operators are set in
the given Optimizable.
classify
public void classify(Optimizable optTable, org.apache.derby.iapi.sql.dictionary.ConglomerateDescriptor cd) throws org.apache.derby.iapi.error.StandardException
- Classify the predicates in this list according to the given
table and conglomerate. Each predicate can be a start key, stop key,
and/or qualifier, or it can be none of the above. This method
also orders the predicates to match the order of the columns
in a keyed conglomerate. No ordering is done for heaps.
markAllPredicatesQualifiers
public void markAllPredicatesQualifiers()
- Mark all of the predicates as Qualifiers and set the numberOfQualifiers
to reflect this. This is useful for hash joins where all of the
predicates in the list to be evaluated during the probe into the
hash table on a next are qualifiers.
hasOptimizableEqualityPredicate
public boolean hasOptimizableEqualityPredicate(Optimizable optTable, int columnNumber, boolean isNullOkay) throws org.apache.derby.iapi.error.StandardException
- Is there an optimizable equality predicate on the specified column?
hasOptimizableEquijoin
public boolean hasOptimizableEquijoin(Optimizable optTable, int columnNumber) throws org.apache.derby.iapi.error.StandardException
- Is there an optimizable equijoin on the specified column?
putOptimizableEqualityPredicateFirst
public void putOptimizableEqualityPredicateFirst(Optimizable optTable, int columnNumber) throws org.apache.derby.iapi.error.StandardException
- Find the optimizable equality predicate on the specified column and make
it the first predicate in this list. This is useful for hash joins where
Qualifier[0] is assumed to be on the hash key.
transferPredicates
public void transferPredicates(OptimizablePredicateList otherList, org.apache.derby.iapi.util.JBitSet referencedTableMap, Optimizable table) throws org.apache.derby.iapi.error.StandardException
- Transfer the predicates whose referenced set is contained by the
specified referencedTableMap from this list to the other list.
This is useful when splitting out a set of predicates from a larger
set, like when generating a HashScanResultSet.
transferAllPredicates
public void transferAllPredicates(OptimizablePredicateList otherList) throws org.apache.derby.iapi.error.StandardException
- Transfer all the predicates from this list to the given list.
copyPredicatesToOtherList
public void copyPredicatesToOtherList(OptimizablePredicateList otherList) throws org.apache.derby.iapi.error.StandardException
- Non-destructive copy of all of the predicates from this list to the
other list.
This is useful when splitting out a set of predicates from a larger
set, like when generating a HashScanResultSet.
setPredicatesAndProperties
public void setPredicatesAndProperties(OptimizablePredicateList otherList) throws org.apache.derby.iapi.error.StandardException
- Sets the given list to have the same elements as this one, and
the same properties as this one (number of qualifiers and start
and stop predicates.
isRedundantPredicate
public boolean isRedundantPredicate(int predNum)
- Return whether or not the specified entry in the list is a redundant
predicate. This is useful for selectivity calculations because we
do not want redundant predicates included in the selectivity calculation.
startOperator
public int startOperator(Optimizable optTable)
- Get the start operator for the given Optimizable for a heap or
index scan.
stopOperator
public int stopOperator(Optimizable optTable)
- Get the stop operator for the given Optimizable for a heap or
index scan.
generateQualifiers
public void generateQualifiers(ExpressionClassBuilderInterface acb, org.apache.derby.iapi.services.compiler.MethodBuilder mb, Optimizable optTable, boolean absolute) throws org.apache.derby.iapi.error.StandardException
- Generate the qualifiers for a scan. This method generates an array
of Qualifiers, and fills them in with calls to the factory method
for generating Qualifiers in the constructor for the activation.
It stores the array of Qualifiers in a field in the activation, and
returns a reference to that field.
If there are no qualifiers, it initializes the array of Qualifiers
to null.
generateStartKey
public void generateStartKey(ExpressionClassBuilderInterface acb, org.apache.derby.iapi.services.compiler.MethodBuilder mb, Optimizable optTable) throws org.apache.derby.iapi.error.StandardException
- Generate the start key for a heap or index scan.
generateStopKey
public void generateStopKey(ExpressionClassBuilderInterface acb, org.apache.derby.iapi.services.compiler.MethodBuilder mb, Optimizable optTable) throws org.apache.derby.iapi.error.StandardException
- Generate the stop key for a heap or index scan.
sameStartStopPosition
public boolean sameStartStopPosition()
throws org.apache.derby.iapi.error.StandardException
- Can we use the same key for both the start and stop key.
This is possible when doing an exact match on an index
where there are no other sargable predicates.
selectivity
public double selectivity(Optimizable optTable) throws org.apache.derby.iapi.error.StandardException
- calculate the selectivity for a set of predicates.
If statistics exist for the predicates this method uses the
statistics. If statistics do not exist, then simply call
selectivity for each of the predicates and return the result.
|
|||||||||
| Home >> All >> org >> apache >> derby >> iapi >> sql >> [ compile overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC