Hi,

I am using h2 1.4.191 version.

I have created Person table with indexes on id and name.

*select * from Person p where p.id in ('1', '3') OR name in ('name0', 
'name1') order by id  *is not using indexes. 

As IN query does not use index, i have written the above query -

*select * from (*
*     select * from Person p join table(joinId varchar(10) = ?) i on p.id = 
i.joinId*
*          UNION*
*    select * from Person p join table(name varchar(10) = ?) i on p.id = 
i.name*
*) order by id*

But above query is not using index at all. union is using index without 
outer query.

* select * from Person p join table(joinId varchar(10) = ?) i on p.id = 
i.joinId*
*          UNION*
*select * from Person p join table(name varchar(10) = ?) i on p.id = i.name*

Could you please share the work around to fix the issue ? thanks.

Thanks.

-- 
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 https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Reply via email to