注册

SQL索引优化

临渊羡鱼 2022/11/04 1168 1

为提高效率,提问时请提供以下信息,问题描述清晰可优先响应。
【DM版本】:1-1-144-20.11.20-130572-ENT
【操作系统】:4.19.90-24.4.v2101.ky10
【CPU】:
【问题描述】: 数据量15万左右,索引尝试了各种组合,始终需要3-4秒
请帮忙看看怎么建索引合适
select
tmp.

from
(
select
t1.id AS “id” ,
t1.title AS “title” ,
t1.content AS “content” ,
t1.remarks AS “remarks” ,
t1.url AS “url” ,
t1.type AS “type” ,
t1.status AS “status” ,
IFNULL(t1_status.name, ‘’) AS “status_Name” ,
t1.receive_user_id AS “receive_user_id” ,
IFNULL(t1_receive_user_id.name, ‘’) AS “receive_user_id_Name”,
t1.message_type AS “message_type” ,
IFNULL(t1_message_type.name, ‘’) AS “message_type_Name” ,
t1.create_date AS “create_date” ,
t1.send_user_id AS “send_user_id” ,
t1.task_id AS “task_id”
from
z_message AS t1
left join z_dict AS t1_status
on
t1.status=t1_status.id
left join sys_user AS t1_receive_user_id
on
t1.receive_user_id=t1_receive_user_id.id
left join z_dict AS t1_message_type
on
t1.message_type=t1_message_type.id
left join sys_user AS t1_send_user_id
on
t1.send_user_id=t1_send_user_id.id
where
t1.del_flag = 0
and t1.message_type in (‘99d691b34db6435ab9905c74afbf8cd8’, ‘3ae91a0edbb64456ad962ba4193f6ccc’)
order by
t1.create_date desc limit 0,
10
) as tmp ;
image.png

回答 0
暂无回答
扫一扫
联系客服