mysql - show profiles 不显示查询

标签 mysql

大家好。有人可以解释为什么 show profiles 不显示查询吗? 这是我尝试的输出:

mysql> set profiling = 1;
Query OK, 0 rows affected (0.00 sec)

mysql> use slow;
Database changed
mysql> show profiles;
+----------+------------+-------------------+
| Query_ID | Duration   | Query             |
+----------+------------+-------------------+
|        1 | 0.00024275 | SELECT DATABASE() |
+----------+------------+-------------------+
1 row in set (0.00 sec)

mysql> select count(*) from people;
+----------+
| count(*) |
+----------+
|   500000 |
+----------+
1 row in set (0.00 sec)

mysql> show profiles;
+----------+------------+-----------------------------+
| Query_ID | Duration   | Query                       |
+----------+------------+-----------------------------+
|        1 | 0.00024275 | SELECT DATABASE()           |
|        2 | 0.00030825 | select count(*) from people |
+----------+------------+-----------------------------+
2 rows in set (0.00 sec)

mysql> select
    -> concat_ws('-',min(age(dob)),max(age(dob))) as year,
    -> count(*) as total
    -> from people
    -> group by if(age(dob)=0,1,ceil(age(dob)/5))
    -> ;
+---------+-------+
| years   | total |
+---------+-------+
| 0-5     | 29789 |
| 6-10    | 24847 |
| 11-15   | 24670 |
| 16-20   | 24764 |
| 21-25   | 24751 |
| 26-30   | 24753 |
| 31-35   | 24817 |
| 36-40   | 24505 |
| 41-45   | 24540 |
| 46-50   | 24745 |
| 51-55   | 24575 |
| 56-60   | 24441 |
| 61-65   | 24953 |
| 66-70   | 24760 |
| 71-75   | 24586 |
| 76-80   | 24647 |
| 81-85   | 24819 |
| 86-90   | 24879 |
| 91-95   | 24683 |
| 96-100  | 24829 |
| 101-101 |   647 |
+---------+-------+
21 rows in set (31.42 sec)

mysql> show profiles;
+----------+------------+-----------------------------+
| Query_ID | Duration   | Query                       |
+----------+------------+-----------------------------+
|        1 | 0.00024275 | SELECT DATABASE()           |
|        2 | 0.00030825 | select count(*) from people |
+----------+------------+-----------------------------+
2 rows in set (0.00 sec)

提前致谢。

最佳答案

我也找不到任何引用,所以认为这是一个错误:

http://bugs.mysql.com/bug.php?id=61328

关于mysql - show profiles 不显示查询,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5036780/

相关文章:

python - Django:对象没有属性 'id'

mysql - 如何使用 SSL 连接对 Mysql 运行 Sequel 迁移

Mysql游标循环只运行一次

php - 创建动态 SQL 搜索

php - GroupBy 和 OrderBy Laravel Eloquent

mysql - 显示我与引座员有共同点的条目,按好恶分开

mysql - SQL按类别平均列

php - 在php中从EDT转换为GMT+05.30时区以在mysql数据库中输入时间戳

php - 从 PHP 页面记录 MySQL 响应

mysql - 在 SQL 中汇总不同货币的销售额