db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Knut Anders Hatlen (JIRA)" <j...@apache.org>
Subject [jira] Updated: (DERBY-4791) LIKE operator optimizations and concatenation
Date Mon, 06 Sep 2010 15:46:32 GMT

     [ https://issues.apache.org/jira/browse/DERBY-4791?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Knut Anders Hatlen updated DERBY-4791:
--------------------------------------

    Issue & fix info:   (was: [Patch Available])

Thanks for the quick review, Bryan! Committed revision 993074.

> LIKE operator optimizations and concatenation
> ---------------------------------------------
>
>                 Key: DERBY-4791
>                 URL: https://issues.apache.org/jira/browse/DERBY-4791
>             Project: Derby
>          Issue Type: Improvement
>          Components: SQL
>    Affects Versions: 10.6.1.0
>         Environment: All
>            Reporter: Uriah Eisenstein
>         Attachments: fold-constants.diff
>
>
> While queries of the form "<column> LIKE ' <string-constant>%' " are optimized
into index scans, the equivalent expression using a concatenation "<column> LIKE ' <string-constant>'
|| '%' " would result in a table scan. 
> Queries of the form "<column> LIKE ?" are optimizable using an internally generated
parameter, so it doesn't seem far-fetched to generate such a parameter for a concatenation
of strings (or other string expressions) as well, once its value has been calculated. This
is of course limited to cases where the result of the string expression can be calculated
once, i.e. it is independent of columns in the query.
> It is sometimes possible to work around this by manually adding the " x >= '<string-constant>'
AND x < '<string-constant>\uffff...'  " condition.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message