索引优化

性能下降sql慢!执行时间场等待时间长

 

索引失效:单值   复合  

 

joins 连接语句

内连接:select * from  tableA A inner join tableB B on a.ket=b.key (两个表的交集)

左连接:select * from tableA A left join tableB B on A.key=B.key (左表的所有加两表的交集)

右连接:select * from tableA A right join tableB B on A.key=B.key (右表的所有加两表的交集)

左差集:select * from tableA A left join tableB B on A.key=B.key where b.key is null 

右差集:select * from tableA A right join tableB B on A.key=B.key where b.key is null

全连接:select * from tableA A full outter join tableB B on A.key=B.key   (mysql不支持) 可以用(左连接  union 右连接) 来代替

两表独有的: select * from tableA A full outer join table B B on A.key=B.key where A.key is null or B.key is null     

(mysql不支持) 可以用(左差集  union 右差集) 来代替

 

什么是索引:是一种数据结构,他能够帮助sql高效的获取数据。

排好序的快速查找数据结构。

劣势:、

 

 

索引失效

快速插入大量的数据 (先创建函数,然后创建存储过程)

随机生成部门编号

调用

 

posted @ 2019-08-06 22:34  new海  阅读(106)  评论(0编辑  收藏  举报