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