chengfengjie / chengfengjie.github.io

我叫MT
1 stars 0 forks source link

SQL优化 #29

Open chengfengjie opened 6 years ago

chengfengjie commented 6 years ago

通过show status命令了解各种SQL的执行频率

SHOW [session|global] STATUS: 可以获取服务器状态信息, session参数显示session级别,global全局级别

chengfengjie commented 6 years ago

通过EXPLAIN分析低效SQL的执行计划

EXPLAIN SELECT * FROM Estate_BasicInfo WHERE estateID = 134\G

输出:

           id: 1
  select_type: SIMPLE
        table: Estate_BasicInfo
   partitions: NULL
         type: const
possible_keys: PRIMARY
          key: PRIMARY
      key_len: 4
          ref: const
         rows: 1
     filtered: 100.00
        Extra: NULL

输出字段说明: