我有一个日志表 数据量比较大 前端只展示一个表格
以下是我F12拿的活字格表格的查询SQL 执行5秒多
- select a.`Id` as C0,a.`operation_type` as C1,a.`table_name` as C2,a.`operation_key` as C3,a.`operation_content` as C4,a1.`Name` as C5,a.`create_time` as C6 from `njbl`.`ServiceLog` as a left join `njbl`.`m_Staff` as a1 on a.`operation_user` = a1.`WorkNo` ORDER BY a.`Id` ASC limit 20 offset 0
复制代码
下面是我去除 ORDER BY 执行时间0.2秒
按理说ORDER BY的字段有索引查询会走索引的 但是我看执行计划并没有走 operation_user字段有索引 m_Staff表中的WorkNo也有索引
|