Thanks Thomas, your analysis is correct. I tried using the same query
with only tables(and not the views) and it took very less time.
I will go ahead and start using it with tables instead of views.

On Nov 3, 4:53 am, Thomas Mueller <[email protected]>
wrote:
> Hi,
>
> I can reproduce the problem. It looks like H2 doesn't use an index because
> you are using a view instead of querying the table directly. I understand
> it's not nice, and I will try to solve this problem, but I can't promise
> when I will have time. My test case is:
>
> drop view test_view;
> drop table test;
> create table test(a int, b int, primary key(a, b));
> create view test_view as select * from test;
> insert into test select x, x from system_range(1, 10);
>
> -- using an index:
> explain select * from test where a in(1, 5);
>
> -- not using a index:
> explain select * from test_view where b in(1, 5);
>
> 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