1. 查看执行计划 explain + 执行慢的sql 这个可以看出是哪个表的哪个外键需要加索引 2.查看索引 show index from 表名 3,添加索引 alter table 表名 add index index_字段名(字段名)