mysql> set profiling=1;
Query OK, 0 rows affected (0.00 sec)
mysql> select now();
+---------------------+
| now() |
+---------------------+
| 2016-07-11 11:10:37 |
+---------------------+
1 row in set (0.00 sec)
mysql> show profiles;
+----------+------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Query_ID | Duration | Query |
+----------+------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| 1 | 4.79560350 | SELECT rgu.user_id as recipient_id, 0 as recipient_type, srg.alarm_settings_id, srg.recipient_group_id, rg.notification_type, u.agreement_id, u.name, u.email, u.mobile_no, u.wechat_no, u.notification_hour_from, u.notification_hour_to
FROM NL_U_ALARM_SETTINGS_RECIPIENT_GROUP srg
INNER JOIN NL_U_ALAR |
+----------+------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.02 sec)
mysql> set @query_id=1;
Query OK, 0 rows affected (0.00 sec)
mysql> select state,sum(duration) as Total_R, round(100*sum(duration)/(select sum(duration) from information_schema.profiling where query_id=@query_id),2) as Pct_R, count(*) as Calls, sum(duration)/count(*) as "R/Call" from information_schema.profiling where query_id=@query_id group by state order by Total_R desc;
+----------------------+----------+-------+-------+--------------+
| state | Total_R | Pct_R | Calls | R/Call |
+----------------------+----------+-------+-------+--------------+
| Sending data | 4.753893 | 99.13 | 4 | 1.1884732500 |
| removing tmp table | 0.038097 | 0.79 | 1 | 0.0380970000 |
| System lock | 0.000906 | 0.02 | 1 | 0.0009060000 |
| Opening tables | 0.000517 | 0.01 | 1 | 0.0005170000 |
| checking permissions | 0.000354 | 0.01 | 8 | 0.0000442500 |
| preparing | 0.000332 | 0.01 | 3 | 0.0001106667 |
| optimizing | 0.000276 | 0.01 | 3 | 0.0000920000 |
| starting | 0.000262 | 0.01 | 1 | 0.0002620000 |
| executing | 0.000220 | 0.00 | 3 | 0.0000733333 |
| statistics | 0.000212 | 0.00 | 3 | 0.0000706667 |
| closing tables | 0.000185 | 0.00 | 1 | 0.0001850000 |
| freeing items | 0.000164 | 0.00 | 1 | 0.0001640000 |
| cleaning up | 0.000128 | 0.00 | 1 | 0.0001280000 |
| logging slow query | 0.000045 | 0.00 | 1 | 0.0000450000 |
| query end | 0.000013 | 0.00 | 1 | 0.0000130000 |
+----------------------+----------+-------+-------+--------------+
15 rows in set (0.01 sec)
mysql> set profiling=0;
Query OK, 0 rows affected (0.00 sec)
运维网声明
1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网 享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com