mysql查询计划语句_mysql语句及执行计划

数据库链接:

mysql -uroot -p

mysql -h10.0.0.100 -uuser -password

show databases

INSERT into `user` (

select id+3333504 ,`user_name` , `password` ,

`birthday` , `mobile` , `email` , `province` , `city` , `region` , `create_at` , `update_at` ,

`login_at` , `last_login_at` , `account_status` , `account_open_at`, `risk_at` , `risk_end` , `risk` ,

`nick` , `sms_status`, `source` , `fund_account` , `branch_no` , `id_no` , `client_name` ,

`friend_id` , `client_id` , `user_type` , `sale_licence` , `operate_code` , `user_status` , `user_trace`, `remote_addr` , `channel`

from `user` )

计划任务:

mysql> show variables like "%pro%";

mysql> set profiling=1;

mysql> use test --切换使用db

select id_no,user_name,mobile from `user` where SUBSTR(id_no,11,4)='0512' ; --执行sql

mysql> show profiles; --查看sql记录

mysql> show profile for query 2; ---查看详情计划任务

mysql> show profile block io,cpu for query 3; ---CPU、IO使用情况

mysql> show profile memory for query 3; --内存使用

1f4071f1353a4ea5fc97305e179d262d.png

dad4bcbee4e1c701bbf909f8afd55d59.png

{

"Status": "query end", 状态

"Duration": "1.751142", 持续时间

"CPU_user": "0.008999", cpu用户

"CPU_system": "0.003999", cpu系统

"Context_voluntary": "98", 上下文主动切换

"Context_involuntary": "0", 上下文被动切换

"Block_ops_in": "8", 阻塞的输入操作

"Block_ops_out": "32", 阻塞的输出操作

"Messages_sent": "0", 消息发出

"Messages_received": "0", 消息接受

"Page_faults_major": "0", 主分页错误

"Page_faults_minor": "0", 次分页错误

"Swaps": "0", 交换次数

"Source_function": "mysql_execute_command", 源功能

"Source_file": "sql_parse.cc", 源文件

"Source_line": "4465" 源代码行

},

简单一点:

explain select * from tab_no_index ;

ecc7701bf5dfdd2dc0241e6cc7566d25.png

时间戳:

mysql>SELECT FROM_UNIXTIME( 1249488000, '%Y%m%d' )

mysql> SELECT UNIX_TIMESTAMP('2009-08-06') ;

SELECT DATE_FORMAT(date_id,'%Y-%m-%d') from batch_select_check_point a where date_id< STR_TO_DATE('2016-08-10','%Y-%m-%d')

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值