Java DB

Apache Derby

Derby Performance Tuning

Derby Getting Started
Derby Reference Manual
Derby Developer's Guide
Derby Performance Tuning
Derby Server and Admin Guide
Derby Tools and Utilities
Derby Performance Tuning
-Performance tips and tricks
-Tuning databases and applications
-DML statements and performance
-Performance and optimization
-Locking and performance
-Non-cost-based optimizations
-Overriding the default optimizer behavior
-Selectivity and cardinality statistics
-Internal language transformations
-Predicate transformations
-Transitive closure
-View transformations
-Subquery processing and transformations
-Outer join transformations
-Sort avoidance
-Aggregate processing
-

 

Unknown parameter

'The situation is similar to those described above when a column is compared using the LIKE operator to a parameter whose value is unknown in advance (dynamic parameter, join column, etc.).

In this situation, the LIKE predicate is likewise transformed into three predicates: one LIKE predicate, one predicate using the >= operator, and one predicate using the < operator. For example:
country LIKE ?
is transformed into
country LIKE ?
AND country >= InternallyGeneratedParameter
AND country < InternallyGeneratedParameter
where the InternallyGeneratedParameters are calculated at the beginning of execution based on the value of the parameter.
Note: This transformation can lead to a bad plan if the user passes in a string that begins with a wildcard or a nonselective string as the parameter. Users can work around this possibility by writing the query like this (which is not optimizable):
(country || '') LIKE ?
 

javadb@jdbcurl.com