MySQL端直接执行,400毫秒响应时间;
Doris端查询,2800毫秒响应时间;
查询语句都是 select * from xxx_view limit 10000;
视图语句
create view xxx_view as
select a.id AS id,
a.task_id AS task_id,
a.sdate AS sdate,
b.task_status AS task_status,
from (test.t1 a left join test.t2 b
on (((a.task_id = b.task_id) and (b.data_flag = 1))))
where (( a.sdate >= date_format(curdate() - interval 5 day, '%Y-%m-%d')) and (a.create_flag = 1));
create table t1
(
id bigint not null ,
task_id bigint not null,
sdate varchar(64) null,
primary key (id, task_id)
)
comment '';
create index sdate
on t1 (sdate);
create table t2
(
id bigint not null comment ''
task_id bigint not null,
)
comment '';
create index task_id
on t2 (task_id);