日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

Mysql内置优化工具show profiles

發(fā)布時間:2025/4/16 数据库 31 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Mysql内置优化工具show profiles 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

一、概述:

Mysql的explain工具目前還沒有Oracle的explain plan工具那么強大,但是結(jié)合show profiles工具可以實現(xiàn)相似的效果。show profiles語句用于在當(dāng)前會話執(zhí)行的語句的資源使用情況。其具體語法為:

SHOW PROFILE [type [, type] ... ][FOR QUERY n][LIMIT row_count [OFFSET offset]] type:ALL| BLOCK IO| CONTEXT SWITCHES| CPU| IPC| MEMORY| PAGE FAULTS| SOURCE| SWAPS

二、開啟profiling

show variables like '%profil%';

set @@session.profiling=1; --會話級別開啟

show profiles在Mysql5.6.7之后官方已經(jīng)不推薦繼續(xù)使用(deprecated),轉(zhuǎn)而支持performance_schema(感覺老麻煩,還是show profile簡單),performance_schema用法詳見如下鏈接:

https://dev.mysql.com/doc/refman/5.6/en/performance-schema-query-profiling.html

三、show profiles的使用

廢話不多說,直接3張圖說明。(注意:單個query查詢用的是show profile不是show profiles)

至于圖中各個列的解釋,官網(wǎng)說明在此:(即infomation_schema.PROFILING表的說明)

QUERY_ID is a numeric statement identifier. SEQ is a sequence number indicating the display order for rows with the same QUERY_ID value. STATE is the profiling state to which the row measurements apply. DURATION indicates how long statement execution remained in the given state, in seconds. CPU_USER and CPU_SYSTEM indicate user and system CPU use, in seconds. CONTEXT_VOLUNTARY and CONTEXT_INVOLUNTARY indicate how many voluntary and involuntary context switches occurred. BLOCK_OPS_IN and BLOCK_OPS_OUT indicate the number of block input and output operations. MESSAGES_SENT and MESSAGES_RECEIVED indicate the number of communication messages sent and received. PAGE_FAULTS_MAJOR and PAGE_FAULTS_MINOR indicate the number of major and minor page faults. SWAPS indicates how many swaps occurred. SOURCE_FUNCTION, SOURCE_FILE, and SOURCE_LINE provide information indicating where in the source code the profiled state executes.

轉(zhuǎn)載于:https://www.cnblogs.com/leohahah/p/8385528.html

總結(jié)

以上是生活随笔為你收集整理的Mysql内置优化工具show profiles的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。