wlhebut

以前没有亲自添加过索引,今天添加了一下,果真强大。几百倍的速度提升。

SELECT * FROM tbl_sys_menu m WHERE m.SID in (SELECT mr.MENU_SID FROM tbl_sys_mrole mr WHERE mr.ROLE_SID in (SELECT ur.ROLE_SID from tbl_sys_urole ur WHERE ur.USER_SID=(SELECT SID FROM tbl_sys_user u WHERE u.LOGIN_NAME=\'fuli\') and ur.ENABLED=1) and mr.ENABLED=1); -- 某一个用户拥有的角色查询。


-- 创建如下索引从200多秒,直接下降到0.069秒
tbl_sys_user u WHERE u.LOGIN_NAME;
CREATE INDEX LOGIN_NAME_index ON tbl_sys_user (LOGIN_NAME);
-- 查看索引
show index from tbl_sys_menu;
show index from tbl_sys_mrole;
show index from tbl_sys_urole;
show index from tbl_sys_user;

分类:

技术点:

相关文章:

  • 2021-09-15
  • 2021-08-13
  • 2021-11-05
  • 2021-11-11
  • 2021-11-11
  • 2021-11-21
  • 2021-11-11
  • 2021-11-21
猜你喜欢
  • 2021-12-22
  • 2021-10-12
  • 2021-10-12
  • 2021-10-12
  • 2021-11-16
  • 2021-10-12
  • 2021-10-12
相关资源
相似解决方案