mysql优化

1 mysql 优化工具

开启慢查询 日志

SHOW VARIABLES LIKE '%slow_query%'

slow_query_log

slow_query_log_file

 

SHOW VARIABLES LIKE '%long_query%'

long_query_time

 

优化工具

EXPLAIN   SELECT * FROM course;

1 type 针对边的访问方法 速度有快到慢  system const eq_ref  range(目标最好是range) index(索引全部扫描) all

2 filtered 过滤百分比

3 Extra 

          using index 覆盖索引

          using where 要在server层过滤

         using  index condition

         using filesort  

         using temporary

 利器:EXPLAIN FORMAT=JSON SELECT * FROM course;

《高性能mysql》

----------------------

@郭海,@先增

面试时问 mysql如何优化?该咋回答?

 

posted @ 2022-09-02 14:44  白芷100  阅读(10)  评论(0)    收藏  举报