-
-
Notifications
You must be signed in to change notification settings - Fork 231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
View/subselect with "union" does not use computed index [CORE4937] #5228
Comments
Commented by: @dyemanov Please test the v2.5.5 snapshot build. As far as I see, it uses both indices in your samples. So this issue is supposedly fixed there. |
Commented by: Reginald Poyau (rpoyau) I have tested first test I submitted and it works with 2.5.5.26930-0 snapshot . however a more complicated computed column with index fails. New test: PLAN (TEST1 INDEX (TEST1_IDX1)) PLAN (TEST1 NATURAL) PLAN (TEST_VIEW2 TEST1 NATURAL) |
Commented by: @dyemanov This should also be fixed now, please check with the next (tomorrow's) snapshot build. |
Modified by: @dyemanovassignee: Dmitry Yemanov [ dimitr ] |
Commented by: Reginald Poyau (rpoyau) I have confirmed that both tests now pass on snapshot build 2.5.5.26932-0. |
Modified by: @dyemanovstatus: Open [ 1 ] => Resolved [ 5 ] resolution: Fixed [ 1 ] Fix Version: 2.5.5 [ 10670 ] |
Modified by: @pavel-zotovstatus: Resolved [ 5 ] => Resolved [ 5 ] QA Status: No test => Done successfully |
Modified by: @pavel-zotovstatus: Resolved [ 5 ] => Closed [ 6 ] |
Submitted by: Reginald Poyau (rpoyau)
Is related to CORE4927
How to reproduce:
1> run isql
> create table test1 (id integer not null primary key, tms timestamp default current_timestamp);
> create table test2 (id integer not null primary key, tms timestamp default current_timestamp);
> alter table test1 add occurred integer computed by (case when tms < current_timestamp then 1 else 0 end);
> create index test1_idx0 on test1 computed by (case when tms < current_timestamp then 1 else 0 end);
> alter table test2 add occurred integer;
> create index test2_idx0 on test2(occurred);
> insert into test1(id) values(1);
> insert into test2(id) values(1);
> commit;
> set plan;
select * from test1 where occurred = 1;
PLAN (TEST1 INDEX (TEST1_IDX0))
> select * from test2 where occurred = 1;
PLAN (TEST2 INDEX (TEST2_IDX0))
> select * from (select * from test1 union select * from test2) where occurred = 1;
PLAN (TEST1 NATURAL)
PLAN (TEST2 INDEX (TEST2_IDX0))
============ =========== ============
1 18-SEP-2015 1
> commit;
> create view test_view as select * from test1 union select * from test2;
> select * from test_view where occurred = 1;
PLAN (TEST_VIEW TEST1 NATURAL)
PLAN (TEST_VIEW TEST2 INDEX (TEST2_IDX0))
============ =========== ============
1 18-SEP-2015 1
>
Notice that subselect on union on test1 and test2 index TEST1_IDX0 did not get used.
Notice that select test_view also did not use TEST1_IDX0 index.
Commits: 6e50d9b FirebirdSQL/fbt-repository@395f5be
The text was updated successfully, but these errors were encountered: