zoukankan      html  css  js  c++  java
  • [mysql] 查看mysql执行时间

    mysql的 profiling不是默认打开的

    查看profiling是否找开

    mysql> show variables like "%pro%";
    +---------------------------+-------+
    | Variable_name             | Value |
    +---------------------------+-------+
    | profiling                 | OFF   |
    | profiling_history_size    | 15    |
    | protocol_version          | 10    |
    | slave_compressed_protocol | OFF   |
    +---------------------------+-------+

    打开profiling

    mysql> set profiling=1;

    使用

    mysql> show tables;
    +----------------+
    | Tables_in_test |
    +----------------+
    | test    |
    | user           |
    +----------------+
    mysql> select * from test;
    mysql> show profiles;
    +----------+------------+------------------------+
    | Query_ID | Duration   | Query                  |
    +----------+------------+------------------------+
    |        1 | 0.00054675 | show tables            |
    |        2 | 0.00032400 | select * from test       |
    +----------+------------+------------------------+
    2 rows in set (0.00 sec)
    mysql> show profile for query 1;
    +----------------------+-----------+
    | Status               | Duration  |
    +----------------------+-----------+
    | (initialization)     | 0.000028  |
    | checking permissions | 0.000007  |
    | Opening tables       | 0.0000939 |
    | System lock          | 0.0000017 |
    | Table lock           | 0.0000055 |
    | init                 | 0.000009  |
    | optimizing           | 0.0000027 |
    | statistics           | 0.0000085 |
    | preparing            | 0.0000065 |
    | executing            | 0.000004  |
    | checking permissions | 0.000258  |
    | Sending data         | 0.000049  |
    | end                  | 0.0000037 |
    | query end            | 0.0000027 |
    | freeing items        | 0.0000307 |
    | closing tables       | 0.0000032 |
    | removing tmp table   | 0.0000275 |
    | closing tables       | 0.0000037 |
    | logging slow query   | 0.000002  |
    +----------------------+-----------+
    19 rows in set (0.00 sec)

      

  • 相关阅读:
    运用jQuery实现动态点赞
    $scope作用及模块化解决全局问题
    angular数据绑定---js全局学习
    HDU 2102 A计划 (深搜)
    ffmpeg 常用命令汇总
    基于Red5与ffmpeg实现rtmp处理NVR或摄像头的监控视频处理方案
    Linux 下编写.sh文件运行JAR下的Class
    如何帮助团队完成一个优秀的API文档,Swagger和Spring Rest Docs两个都是十分优秀的工具!...
    你关心的学历问题在这里
    北京一二线大厂以及程序员层级分布
  • 原文地址:https://www.cnblogs.com/bluefrog/p/3512224.html
Copyright © 2011-2022 走看看