LIKE with parameter recomputes greaterEqualString and lessThanString way too
often
----------------------------------------------------------------------------------
Key: DERBY-4346
URL: https://issues.apache.org/jira/browse/DERBY-4346
Project: Derby
Issue Type: Improvement
Components: SQL
Affects Versions: 10.5.1.1
Reporter: Knut Anders Hatlen
I profiled a 7-way join (the exact query can be found here:
<URL:http://src.opensolaris.org/source/xref/opengrok/trunk/src/org/opensolaris/opengrok/history/JDBCHistoryCache_queries.properties?r=809%3Abdef8b63f333#82>)
and saw that 40% of the time was spent in
Like.greaterEqualStringFromParameterWithEsc() and
Like.lessThanStringFromParameterWithEsc().
These methods are used to generate "x >= greaterEqualString" and "x <
lessThanString" clauses that enable a "LIKE ?" clause to make use of indexes.
Since the value of the ? parameter is constant throughout a single execution of
the statement, it should only be necessary to invoke these methods once per
LIKE clause per execution. They are clearly called more frequently for the
query in question, and reducing the number of invocations to one per execution
would probably make the query execute almost twice as fast.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.