HelloBarreat 2018-09-26 03:50 采纳率: 0%
浏览 1108

sql优化 在线等 sql优化 在线等。

图片说明

这是EXPLAIN图
sql语句如下 该加的索引都加了 可就是不走索引
SELECT
e.*, u.user_name,
MAx(yc. STATUS)AS jzstatus,
u.real_name URealName,
au.real_name auditRealName,
su.real_name settleRealName,
u.mobile,
c.zh_name customer_name,
c. CODE customer_code,
c.total_amount customer_total_amount,
l.boat_name,
l.voyage_num,
l.leave_time,
l.boat_company_name,
l.boat_voyage,
l.loading_name,
l.unload_name,
l.change_name,
b.business_type,
b.container_type,
b.container_num,
b.container_no,
b.business_no,
ct.zh_name conName,
ct. CODE conCode,
ct.con_length,
oe.send_user_name,
oe.order_user_name,
oe.address,
oe.loading_address,
og. NAME goods_name,
IFNULL(sl.real_name, sl.user_name)salesUserRealName,
IFNULL(bu.real_name, bu.user_name)bookUserRealName,
sl.user_name salesUserName,
bu.user_name bookUserName,
op. STATUS oStatus,
op.is_locked oIsLock
FROM
ymcms_expenses e
LEFT JOIN ymcms_user u ON u.id = e.input_people
LEFT JOIN ymcms_user au ON au.id = e.audit_uid
LEFT JOIN ymcms_user su ON su.id = e.settle_uid
LEFT JOIN ymcms_customer c ON c.id = e.customer
LEFT JOIN ymcms_order_lane l ON l.order_id = e.order_id
LEFT JOIN ymcms_order_basic b ON b.id = e.order_id
LEFT JOIN ymcms_container_type ct ON ct.id = b.container_type
LEFT JOIN ymcms_order_entrust oe ON oe.order_id = b.id
LEFT JOIN ymcms_order_product og ON og.order_id = b.id
LEFT JOIN ymcms_user sl ON sl.id = b.sales_user
LEFT JOIN ymcms_order_operation op ON op.order_id = b.id
LEFT JOIN ymcms_user bu ON bu.id = b.book_operation_user
LEFT JOIN ymcms_container yc ON b.id = yc.order_id
WHERE
1 = 1
AND(
(
op. STATUS = 0
AND op.is_deleted = 0
AND e.input_people = '2f67225416cc4b74b6d1113118a43aa9'
)
OR op. STATUS > 0
)
AND e.site_id = '1'
AND l.leave_time >= 1514736000000
GROUP BY
e.id
ORDER BY
l.leave_time DESC,
b.business_no,
e.input_time DESC

各位大佬 帮忙给出一个优化的思路 谢谢
  • 写回答

4条回答

  • JonathanYan 2018-09-26 06:16
    关注

    你确定要把这么对列一次读出来吗,可以试试分成几次查询,如果必须一次读出来我再想想办法

    评论

报告相同问题?

悬赏问题

  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料