Hi,

>> I've never understood the lengths that databases sometimes go to to
>> avoid using the indexes in situations where (it thinks) the table is
>> small.

Me neither. H2 uses an index, even if the table has no rows. I'm not
saying this is smart, but that's how it works. One reason is that the
query plan is re-used for prepared statements in most cases (there are
some exceptions, for example if you use LIKE).

> from a, b where a.zz=b.zz and ((a.xx='string' and a.yy<>'string' ) or 
> (a.yy='string' and a.xx<>'string' and b.qq='1'))

H2 doesn't optimize this yet. If you want, you could rewrite the query
as a UNION:

select * from a, b where a.zz=b.zz and a.xx='string' and a.yy<>'string'
union
select * from a, b where a.zz=b.zz and a.yy='string' and
a.xx<>'string' and b.qq='1'

Regards,
Thomas

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

Reply via email to