@
xiaobaigsy mysql> select @@profiling;
+-------------+
| @@profiling |
+-------------+
| 0 |
+-------------+
1 row in set (0.06 sec)
mysql> set profiling=1;
Query OK, 0 rows affected (0.01 sec)
mysql> select count(1) from history_uint;
+----------+
| count(1) |
+----------+
| 3464122 |
+----------+
1 row in set (1 min 52.51 sec)
mysql> show profiles;
+----------+--------------+-----------------------------------+
| Query_ID | Duration | Query |
+----------+--------------+-----------------------------------+
| 1 | 20.63920150 | select count(*) from history_uint |
| 2 | 112.46709225 | select count(1) from history_uint |
+----------+--------------+-----------------------------------+
2 rows in set (0.06 sec)
mysql> show profile for query 2;
+----------------------+------------+
| Status | Duration |
+----------------------+------------+
| starting | 0.000042 |
| checking permissions | 0.000007 |
| Opening tables | 0.000017 |
| System lock | 0.000009 |
| init | 0.000010 |
| optimizing | 0.000008 |
| statistics | 0.000011 |
| preparing | 0.000008 |
| executing | 0.000004 |
| Sending data | 112.466869 |
| end | 0.000019 |
| query end | 0.000006 |
| closing tables | 0.000014 |
| freeing items | 0.000058 |
| logging slow query | 0.000004 |
| logging slow query | 0.000003 |
| cleaning up | 0.000005 |
+----------------------+------------+
17 rows in set (0.03 sec)
mysql> show profile block io,cpu for query 2;
+----------------------+------------+-----------+------------+--------------+---
------------+
| Status | Duration | CPU_user | CPU_system | Block_ops_in | Bl
ock_ops_out |
+----------------------+------------+-----------+------------+--------------+---
------------+
| starting | 0.000042 | 0.000000 | 0.000000 | NULL |
NULL |
| checking permissions | 0.000007 | 0.000000 | 0.000000 | NULL |
NULL |
| Opening tables | 0.000017 | 0.000000 | 0.000000 | NULL |
NULL |
| System lock | 0.000009 | 0.000000 | 0.000000 | NULL |
NULL |
| init | 0.000010 | 0.000000 | 0.000000 | NULL |
NULL |
| optimizing | 0.000008 | 0.000000 | 0.000000 | NULL |
NULL |
| statistics | 0.000011 | 0.000000 | 0.000000 | NULL |
NULL |
| preparing | 0.000008 | 0.000000 | 0.000000 | NULL |
NULL |
| executing | 0.000004 | 0.000000 | 0.000000 | NULL |
NULL |
| Sending data | 112.466869 | 27.331375 | 3.759624 | NULL |
NULL |
| end | 0.000019 | 0.000000 | 0.000000 | NULL |
NULL |
| query end | 0.000006 | 0.000000 | 0.000000 | NULL |
NULL |
| closing tables | 0.000014 | 0.000000 | 0.000000 | NULL |
NULL |
| freeing items | 0.000058 | 0.000000 | 0.000000 | NULL |
NULL |
| logging slow query | 0.000004 | 0.000000 | 0.000000 | NULL |
NULL |
| logging slow query | 0.000003 | 0.000000 | 0.000000 | NULL |
NULL |
| cleaning up | 0.000005 | 0.000000 | 0.000000 | NULL |
NULL |
+----------------------+------------+-----------+------------+--------------+---
------------+
17 rows in set (0.04 sec)