[ 
https://issues.apache.org/jira/browse/DERBY-2698?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13542885#comment-13542885
 ] 

Knut Anders Hatlen commented on DERBY-2698:
-------------------------------------------

After DERBY-3136 and DERBY-2699 we no longer calculate the array of ints.

There may still be some potential for caching. For example, a query such as

  SELECT * FROM t WHERE x LIKE pattern ESCAPE '#'

will call WorkHorseForCollatorDatatypes.hasSingleCollationElement() on the 
escape string '#' once for each row in the table T, and each call will allocate 
a CollationElementIterator and redo the check.

But it's more of a corner case now than when the issue was filed, so maybe we 
can just close it as Won't Fix.
                
> caching collation elements in WorkHorseForCollatorDatatypes may improve 
> performance.
> ------------------------------------------------------------------------------------
>
>                 Key: DERBY-2698
>                 URL: https://issues.apache.org/jira/browse/DERBY-2698
>             Project: Derby
>          Issue Type: Improvement
>          Components: SQL
>    Affects Versions: 10.3.1.4
>            Reporter: Mike Matrigali
>            Priority: Minor
>              Labels: derby_triage10_10
>
> In 
> java/engine/org/apache/derby/iapi/types/WorkHorseForCollatorDatatypes.getCollationElementsForString()
>  an array
> of int's is calculated given the string and the collator in place.  If like 
> is ever called on the same DataValueDescriptor, caching
> this calculation will be faster than redoing the calculation.  To make this 
> change one needs to properly invalidate the cached
> information when the base type value is changed.  For instance in the case of 
> SQLChar() the following routines all result
> in a change in the value of the datatype and thus need to invalidate any 
> cached collation element structure:
> readExternalFromArray()
> readExternal()
> setValue()
> there may be others.
> DERBY-2670 is an example of what can go wrong if you get the caching wrong.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to