I've noticed a huge performance difference between a query with some
conditions expressed through a IN clause and the corresponding OR conditions
sequence.
H2 uses uses indexes in the former, while it does a tableScan with the
latter.

Here you are a reproducible test case:


where the explain analyze output is, respectively



Please correct me if I'm wrong, but it seems that when I use the OR it does
a tableScan, while with the IN it uses the index implicitly created with the
FK.
I've reproduced it with h2 v. 1.3.171. 
Is it a bug?

Cheers
Davide



--
View this message in context: 
http://h2-database.66688.n3.nabble.com/huge-performance-difference-between-SELECT-WHERE-x-IN-1-2-and-SELECT-WHERE-x-1-OR-x-2-tp4026210.html
Sent from the H2 Database mailing list archive at Nabble.com.

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/h2-database?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to