1. 程式人生 > >查詢sql limit用法,望大神指教

查詢sql limit用法,望大神指教

執行 left join pro span ide _id tween 執行時間 不知道

mysql 中使用了連接查詢,但是使用 limit 後查詢時間反而更長了,沒弄明白什麽原因,sql 如下

SELECT
    `t`.*
FROM
    `order_main` `t`
LEFT JOIN `base_supplier` `c` ON `t`.`OUTSIDE_SALE_ORG_ID` = `c`.`ID`
LEFT JOIN `dict_type` ON `t`.`ORDER_STATUS` = `dict_type`.`ID`
LEFT JOIN `base_user` ON `t`.`CREATE_USER_ID` = `base_user`.`ID`
LEFT JOIN `base_user` `m` ON `t`.`SALES_MAN` 
= `m`.`ID` LEFT JOIN `order_ht_status_log` ON `t`.`ORDER_ID` = `order_ht_status_log`.`ORDER_ID` LEFT JOIN `base_user` `lu` ON `order_ht_status_log`.`CREATE_USER_ID` = `lu`.`ID` WHERE `order_prod_type` = 25 AND `t`.`cancel_flag` = 0 AND `ORDER_VALID_STATUS` = 1 AND `t`.`DOCKING_TYPE` = 556 AND `order_ht_status_log`.`ORDER_STATUS`
= 198 AND `order_ht_status_log`.`BEFORE_STATUS` = 313 AND `t`.`CREATE_TIME` BETWEEN 2018-03-01 00:00:00 AND 2018-03-08 23:59:59 GROUP BY `t`.`ORDER_ID`

如果添加 limit 條件執行時間是當前sql的70~80倍,不知道什麽原因,求大神解惑

查詢sql limit用法,望大神指教