mysql性能分析 -- profile

使用profile对某sql的性能进行分析。使用大致分为四步:

  1. 打开分析:在mysql服务器中执行set profiling = 1;或者在my.cnf/my.ini中加上set profiling = 1;
    profile
    注:在mysql 中一般数字’1’对应’ON’,数字’0’对应’OFF’。
  2. 执行各种语句
    q
  3. show profiles;查看记录的sql
    profiles
  4. show profile [type] for query Query_ID;
    type: ALL、BLOCK IO、CONTEXT SWITCHES、CPU、IPC、MEMORY、PAGE FAULTS、SOURCE、SWAPS
    profile2

猜你喜欢

转载自blog.csdn.net/qq_37502106/article/details/80208479