摘要:
1.永远小表驱动大表 exist 和 in:exist返回 true /false,in 返回具体的结果 1.select * from A where exists (select 1 from B where B.id = A.id) 使用 exist,会先查询A,再去查询B里面 B.id = 阅读全文
摘要:
索引分析 1.单表的优化: 上面的注释已经提到了 BTree 索引的工作原理,在一个联合索引中,按照创建索引时的字段的顺序,来为其进行排序 select a,b from t1 where x = 1 and y > 1 order by z ;联合索引为(x,y,z),x,z给出了一个确切的值,y 阅读全文