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

Richard Evans commented on DERBY-7173:
--------------------------------------

Additionally, with 2 query clauses, and accumulating the time taken:
 # in prepareStatement
 # in executeQuery
 # looping over the result set

The first two average out at around 0.02ms whilst the third averages out at 
around 7.6ms.  

With a single query clause, all three average out at about 0.02ms. 

Seems that with two query clauses, almost all of the time is taken retrieving 
the results.

> Very poor performance with a = ? AND b = ? OR a = ? AND b = ? in query
> ----------------------------------------------------------------------
>
>                 Key: DERBY-7173
>                 URL: https://issues.apache.org/jira/browse/DERBY-7173
>             Project: Derby
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 10.16.1.1
>            Reporter: Richard Evans
>            Priority: Major
>         Attachments: lkp.java
>
>
> Execute a query like:
> SELECT * FROM table WHERE col1 = ? AND col2 = ? OR col1 = ? AND col2 = ?
> Performance is significantly worse then the simpler:
> SELECT * FROM table WHERE col1 = ? AND col2 = ? 
> even though both col1 and col2 are indexed.
> Simple test case attached - run with db directory and number of OR clauses in 
> query - use 2 for first example above and 1 for second.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to