老师讲的不错,都是干货,下面是我的总结,大家可以看看:http://qixingjun.tech/2017/03/10/mysql-optimization/
2017-03-12
这样的sql
select film_id,description FROM sakila.film WHERE film_id>600 and film_id<=605 order by film_id limit 1,5
那个limit 1,5 不是有点重复的意思吗?
select film_id,description FROM sakila.film WHERE film_id>600 and film_id<=605 order by film_id limit 1,5
那个limit 1,5 不是有点重复的意思吗?
2017-03-11
已采纳回答 / 慕仰0354868
不高,用EXISTS替代IN、用NOT EXISTS替代NOT IN: (高效)SELECT * FROM EMP (基础表) WHERE EMPNO > 0 AND EXISTS (SELECT ‘X' FROM DEPT WHERE DEPT.DEPTNO = EMP.DEPTNO AND LOC = ‘MELB') (低效)SELECT * FROM EMP (基础表) WHERE EMPNO > 0 AND DEPTNO IN(SELECT DEPTNO...
2017-03-10