目录
一、MySQL优化
(一) 慢查询
1、如何定位慢查询
2、SQL语句执行的很慢,如何分析?![](https://img-blog.csdnimg.cn/b451b4775d234afebb4e83fd2ec33953.png)
![](https://img-blog.csdnimg.cn/c6c4463a593849b186a6671d770090fa.png)
![](https://img-blog.csdnimg.cn/4609dd5e345e4dd995faa6ade805aa12.png)
![](https://img-blog.csdnimg.cn/84b2c1959c9643da885c68ad9aba30b7.png)
![](https://img-blog.csdnimg.cn/ca80f7cb3e5740bd9f1787cfd2e5156b.png)
(二)什么是索引?![](https://img-blog.csdnimg.cn/c4eb5a5725a34734a149a8de4d0d9e44.png)
![](https://img-blog.csdnimg.cn/e4d9c9d9353b4e16948c44d2e61316bb.png)
![](https://img-blog.csdnimg.cn/379c397a01c1418ba46e5431b2d2dc1d.png)
![](https://img-blog.csdnimg.cn/206b51407918459e996832777fbb5c20.png)
![](https://img-blog.csdnimg.cn/0340fbd8fb7b474da00a7f351c55a6ea.png)
![](https://img-blog.csdnimg.cn/2033a2489d694bf5bbb2a70df2f6fb89.png)
1、聚集索引和非聚集索引![](https://img-blog.csdnimg.cn/a1e99434f7724da5bb99d30e3c6b12b1.png)
2、什么是覆盖索引?
不需要回表查询的操作
3、索引创建的原则有哪些?![](https://img-blog.csdnimg.cn/b90b392351af4e6ebb107a9d63b0825f.png)
4、什么情况下索引会失效?![](https://img-blog.csdnimg.cn/9416d04879d647bc9502a3d7a89b10aa.png)
(三)对sql优化的经验![](https://img-blog.csdnimg.cn/2cee99ca3021497996e87c161991d09c.png)
![](https://img-blog.csdnimg.cn/c287b25e61344eeca4638ca84d172b54.png)
(四)事务
1、事务的特性
2、并发事务带来的问题![](https://img-blog.csdnimg.cn/4e96737f682e45f5b07a72eb8202c8cc.png)
![](https://img-blog.csdnimg.cn/97ed6ff0c330493887737fcb5385ae4d.png)
![](https://img-blog.csdnimg.cn/8b84a413754d47209eba2bcb24212596.png)
3、undo log 和redo log 的区别 ![](https://img-blog.csdnimg.cn/90d8edaf65414830adcd4cc9c6cf4e44.png)
![](https://img-blog.csdnimg.cn/30679041afa2488999958350a546cde5.png)
![](https://img-blog.csdnimg.cn/07438cdd5bb84a74b25a3686bc308380.png)
![](https://img-blog.csdnimg.cn/1caf3883ceb4420a8c7660e31b62e34e.png)
4、mvcc![](https://img-blog.csdnimg.cn/6decc52785bd42d28646b239831e34f9.png)
![](https://img-blog.csdnimg.cn/f71b9a8c5a004e4ea01b59174d8ca79e.png)
![](https://img-blog.csdnimg.cn/45581841f8ed45fb95ac55e95f1f93ff.png)
![](https://img-blog.csdnimg.cn/05ce96d8d2e146c4a05f8c552057a745.png)
![](https://img-blog.csdnimg.cn/d77c00d1176a47cc9ed6c0cc57d20e05.png)
![](https://img-blog.csdnimg.cn/8fefea44240043ec99a056b4666ea4c8.png)
![](https://img-blog.csdnimg.cn/2e47b24139ee45b7ace801ca7c18b3bd.png)
![](https://img-blog.csdnimg.cn/1c6313b2491c44a78c3c2517ed440e41.png)
![](https://img-blog.csdnimg.cn/53bdeed7d7b34badbde760829f8b655a.png)
![](https://img-blog.csdnimg.cn/6523c69825654955a82fdfa0fee1532b.png)
![](https://img-blog.csdnimg.cn/871be3de558e4da2a832f324f37735e6.png)
![](https://img-blog.csdnimg.cn/a08a4955f1424ef9a731568844902fa1.png)
(五) 主从同步 ![](https://img-blog.csdnimg.cn/3ec41882b6334bd5b7f897d4c606f722.png)
(六) 分库分表 ![](https://img-blog.csdnimg.cn/5f50a940ec7d405ba81a3add40c07b14.png)
![](https://img-blog.csdnimg.cn/5f06d19df73944348f4c4588db6d4901.png)
![](https://img-blog.csdnimg.cn/0746e4606b464bda8d0523d5ea40b999.png)
![](https://img-blog.csdnimg.cn/833c27e01435481a9b7a8144b1dc109d.png)
![](https://img-blog.csdnimg.cn/8af0b29ab6d34958ad9c753ac7d34f8f.png)
![](https://img-blog.csdnimg.cn/a29f80c6332c4fe1842290f536b28491.png)
![](https://img-blog.csdnimg.cn/f9bc7a684a0d4192bf5b820178144ca5.png)
![](https://img-blog.csdnimg.cn/1a9b95b1c79643e48824e60c1854dd2c.png)
·