各位前辈,当输入一个查询的时候比如select * from aaa;就会如下信息: +-------------+-----------------+-----------+--------------+---------------------+ 
150000 rows in set (0.99 sec) 其中程序执行时间“0.99”是不是写在一张系统表里的?能不能通过查询这张表获得它?谢谢~

解决方案 »

  1.   


    不在系统表内。
    这个就不清楚了,需要看一下 mysql.exe 这个工具的源代码。看它是从哪得来的。
      

  2.   


    我以为会写到系统表里,然后不断更新呢。
    是说MySQL看什么东西都得用show么?同一个问题我问了两遍,罪过啊~
      

  3.   

    mysql> select * from t;
    +----+------+---------------------+
    | Id | name | updatetime          |
    +----+------+---------------------+
    |  1 | a    | 0000-00-00 00:00:00 |
    |  2 | b    | 0000-00-00 00:00:00 |
    |  3 | c    | 0000-00-00 00:00:00 |
    |  4 | d    | 0000-00-00 00:00:00 |
    |  5 | e    | 0000-00-00 00:00:00 |
    +----+------+---------------------+
    5 rows in set (0.00 sec)mysql> set profiling=1;
    Query OK, 0 rows affected (0.00 sec)mysql> select * from t;
    +----+------+---------------------+
    | Id | name | updatetime          |
    +----+------+---------------------+
    |  1 | a    | 0000-00-00 00:00:00 |
    |  2 | b    | 0000-00-00 00:00:00 |
    |  3 | c    | 0000-00-00 00:00:00 |
    |  4 | d    | 0000-00-00 00:00:00 |
    |  5 | e    | 0000-00-00 00:00:00 |
    +----+------+---------------------+
    5 rows in set (0.00 sec)mysql> show profile;
    +--------------------+----------+
    | Status             | Duration |
    +--------------------+----------+
    | starting           | 0.000063 |
    | Opening tables     | 0.000016 |
    | System lock        | 0.000016 |
    | Table lock         | 0.000008 |
    | init               | 0.000015 |
    | optimizing         | 0.000004 |
    | statistics         | 0.000011 |
    | preparing          | 0.000007 |
    | executing          | 0.000003 |
    | Sending data       | 0.000081 |
    | end                | 0.000010 |
    | query end          | 0.000004 |
    | freeing items      | 0.000209 |
    | logging slow query | 0.000008 |
    | cleaning up        | 0.000007 |
    +--------------------+----------+
    15 rows in set (0.02 sec)mysql> show profiles;
    +----------+------------+-----------------+
    | Query_ID | Duration   | Query           |
    +----------+------------+-----------------+
    |        1 | 0.00046000 | select * from t |
    +----------+------------+-----------------+
    1 row in set (0.00 sec)
    mysql> show profile all;
      

  4.   

    参见
    http://dev.mysql.com/doc/refman/5.1/en/show-profiles.html