mysql查詢計畫語句 mysql語句及執行計畫

2021-10-17 17:41:42 字數 2076 閱讀 8816

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 block io,cpu for query 3; ---cpu、io使用情況

mysql> show profile memory for query 3; --記憶體使用

"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" 源**行

簡單一點:

時間戳:

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')

mysql 查詢執行計畫 MySql執行計畫的檢視

一。什麼是資料庫執行計畫 利用乙個sql語句,你可能要server取出所有news表中的資訊.當server收到的這條sql的時候,第一件事情並不是解析它.如果這條sql沒有語法錯誤,server才會繼續工作.server會決定最好的計算方式.server會選擇,是讀整個news表好呢,還是利用索引...

mysql 查詢計畫 rows 查詢計畫引數詳解

explain這是這次想要了解的重點命令,用於檢視mysql中查詢sql語句的執行計畫,用來對sql進行優化,以最合理的方式寫sql語句 一條標準的sql查詢語句 explain select id from user customer where id 1 g 得到的結果 1.row id 1 s...

mysql 查詢語句

在pdo中有很多模式能用,在使用的時候在用 bindvalue 的時候 在select 中有in 的 語句無法實現,在傳入的時候 select from users where id in 1,2,3 當1,2,3 用 pdo param str 的時候,會出現這種情況 select from ue...