Hi,

For such cases, you currently do need to use "union".

Regards
Thomas
Am 27.09.2011 01:58 schrieb "Thomas Mauch" <[email protected]>:
> Hi,
>
> I have a table test with two columns key1 and key2. There are index on
> both columns and explain plan shows that the indexes are used for the
> queries
>
> - select * from test where key1 = 'x'
> - select * from test where key2 = 'y'
>
> However, If I have a query like
>
> - select * from test where key1 = 'x' or key2 = 'y'
>
> a table scan is done and the indexes are not used.
>
> I searched in the documentation and it seems that hints are (not yet)
> supported.
> Is there another way to force the database to use the indexes?
>
> For this simple example, I could use UNION ALL but this makes query
> statements quite complex. At least explain plan shows the usage of the
> indexes, but I'm not sure whether this would perform well in any case.
>
> Is there any approach you can propose?
>
> 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.
>

-- 
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