sql优化

尽量避免IN 和 NOT IN

参考https://www.cnblogs.com/totian/p/7597300.html

select a.* from tb_auth a where a.auth_id in (select ra.auth_id from tb_role_auth ra where ra.role_id =  3)

select a.* from tb_auth a where exists (select ra.auth_id from tb_role_auth ra where ra.role_id =  3)
原文地址:https://www.cnblogs.com/xiongyungang/p/13157023.html