急急急,请教大神MYSQL 语句优化

IT~搬运工 2019-03-06 10:36:12
select `s1`.`task_code` AS `task_code`,
`s1`.`user_id` AS `user_id`,
`s1`.`phase` AS `phase`,
`s1`.`operation` AS `operation`,
`s1`.`disposing_time` AS `dispatch_time`,
`s1`.`disposal_deadline` AS `disposal_deadline`,
(select `s`.`org_code` from `stats_snapshot_all_phase` `s`
where ((`s`.`phase` = 6)
and (`s`.`disposing_time` > `s1`.`disposing_time`))
order by `s`.`disposing_time` limit 1) AS `org`
from `stats_snapshot_all_phase` `s1`
where ((1 = 1)
and (`s1`.`phase` = 5)
and (`s1`.`operation` = 37))

请教大神如何优化查询速度会变快
...全文
177 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
Maiza久远 2019-03-06
  • 打赏
  • 举报
回复
查询慢先看关键字索引有没有创建 有的话再详细优化
IT~搬运工 2019-03-06
  • 打赏
  • 举报
回复
CSDN现在都没人了吗

6,108

社区成员

发帖
与我相关
我的任务
社区描述
其他数据库开发 数据库报表
社区管理员
  • 数据库报表社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧