2021-07-07 05:01:30 +00:00
|
|
|
drop table if exists t;
|
|
|
|
|
|
|
|
create table t (i int, j int) engine MergeTree order by i;
|
|
|
|
|
|
|
|
insert into t values (1, 2);
|
|
|
|
|
|
|
|
alter table t add projection x (select * order by j);
|
|
|
|
|
|
|
|
insert into t values (1, 4);
|
2023-02-17 19:18:46 +00:00
|
|
|
insert into t values (1, 5);
|
2021-07-07 05:01:30 +00:00
|
|
|
|
2023-05-10 01:35:13 +00:00
|
|
|
set optimize_use_projections = 1, force_optimize_projection = 1;
|
2021-07-07 05:01:30 +00:00
|
|
|
|
|
|
|
select i from t prewhere j = 4;
|
|
|
|
|
|
|
|
SELECT j = 2, i FROM t PREWHERE j = 2;
|
|
|
|
|
2023-02-21 19:50:17 +00:00
|
|
|
SELECT j = -1, j = NULL FROM t WHERE j = -1;
|
|
|
|
|
2021-07-07 05:01:30 +00:00
|
|
|
drop table t;
|