国产成人精品18p,天天干成人网,无码专区狠狠躁天天躁,美女脱精光隐私扒开免费观看

MySQL sys庫常用的SQL命令整理

發(fā)布時(shí)間:2021-09-14 18:07 來(lái)源:億速云 閱讀:0 作者:chen 欄目: Mysql 歡迎投稿:712375056

本篇內容主要講解“ sys庫常用的SQL命令整理”,感興趣的朋友不妨來(lái)看看。本文介紹的方法操作簡(jiǎn)單快捷,實(shí)用性強。下面就讓小編來(lái)帶大家學(xué)習“MySQL sys庫常用的SQL命令整理”吧!

查看當前連接情況:

select host, current_connections,statements from sys.host_summary;

查看當前正在執行的SQL:

select conn_id, user, current_statement, last_statement from sys.session;

查看系統里執行最多的TOP 10 SQL:

select * from sys.statement_analysis order by exec_count desc limit 10 \G

查看系統里哪張表的IO最多:

select * from sys.io_global_by_file_by_bytes limit 10;

查看系統里哪張表訪(fǎng)問(wèn)次數最多:

select * from sys.statement_analysis order by exec_count desc limit 10 \G

查看哪些語(yǔ)句延遲比較嚴重:

select * from sys.statement_analysis order by avg_latency desc limit 10 \G

查看系統里未使用過(guò)的索引:

select * from sys.schema_unused_indexes;

查看系統里冗余的索引:

select table_schema,table_name,redundant_index_name,redundant_index_columns,dominant_index_name,dominant_index_columns from sys.schema_redundant_indexes;

哪些SQL語(yǔ)句使用了磁盤(pán)臨時(shí)表:

select db, query, tmp_tables,tmp_disk_tables from sys.statement_analysis where tmp_tables>0 or tmp_disk_tables >0 order by(tmp_tables+tmp_disk_tables) desc limit 20;

查看哪張表占用了最多的buffer pool:

select * from sys.innodb_buffer_stats_by_table order by pages desc limit 10 \G

查看每個(gè)庫占用多少buffer pool:

select * from sys.innodb_buffer_stats_by_schema;

查看每個(gè)連接分配多少內存:

select b.user, current_count_used,current_allocated, current_avg_alloc, current_max_alloc,total_allocated,current_statement from sys.memory_by_thread_by_current_bytes a,sys.session b where a.thread_id = b.thd_id;

查看MySQL內部的線(xiàn)程類(lèi)型及數量:

select user, count(*) from sys.processlist group by user;

查看表自增ID情況:

select * from sys.schema_auto_increment_columns limit 10;

附:sys庫視圖和指標詳解

視圖                                                                                  說(shuō)明

host_summary,x $ host_summary                                統計以主機為分組統計活動(dòng)的語(yǔ)句,文件I / O,連接等信息

host_summary_by_file_io,x $ host_summary_by_file_io                 文件IO

host_summary_by_file_io_type,x $ host_summary_by_file_io_type       主機和事件類(lèi)型的文件I / O

host_summary_by_stages,x $ host_summary_by_stages                  按照主機分類(lèi)的語(yǔ)句階段執行信息

host_summary_by_statement_latency,x $ host_summary_by_statement_latency按照主機分類(lèi)的語(yǔ)句統計

host_summary_by_statement_type,x $ host_summary_by_statement_type      按照主機和SQL執行的語(yǔ)句信息

innodb_buffer_stats_by_schema,x $ innodb_buffer_stats_by_schema      按照架構統計InnoDB緩沖區信息

innodb_buffer_stats_by_table,x $ innodb_buffer_stats_by_table        按照schema和表統計InnoDB緩沖區信息

innodb_lock_waits,x $ innodb_lock_waits                                 InnoDB鎖鎖信息

io_by_thread_by_latency,x $ io_by_thread_by_latency                       線(xiàn)程消耗IO

io_global_by_file_by_bytes,x $ io_global_by_file_by_bytes                文件IO消耗大小信息

io_global_by_file_by_latency,x $ io_global_by_file_by_latency            文件IO延遲信息

io_global_by_wait_by_bytes,x $ io_global_by_wait_by_bytes              按照大?。ㄗ止潱┑娜諭 / O消耗

io_global_by_wait_by_latency,x $ io_global_by_wait_by_latency          IO消耗的延遲信息

latest_file_io,x $ latest_file_io                                      最近使用文件I / O信息

memory_by_host_by_current_bytes,x $ memory_by_host_by_current_bytes    主機使用內存信息

memory_by_thread_by_current_bytes,x $ memory_by_thread_by_current_bytes線(xiàn)程使用內存信息

memory_by_user_by_current_bytes,x $ memory_by_user_by_current_bytes         用戶(hù)使用內存信息

memory_global_by_current_bytes,x $ memory_global_by_current_bytes             內存使用分配的類(lèi)型

memory_global_total,x $ memory_global_total                                   內存統計信息

指標說(shuō)明                                                                                                            

processlist,x $ processlist                                                Processlist進(jìn)程信息

ps_check_lost_instrumentation                                                 丟失的性能模式工具的信息

schema_auto_increment_columns                                                   AUTO_INCREMENT自增長(cháng)列信息

schema_index_statistics,x $ schema_index_statistics                         索引統計信息

schema_object_overview                                                         每個(gè)模式的對象類(lèi)型

schema_redundant_indexes                                                       重復/冗余的索引

schema_table_lock_waits,x $ schema_table_lock_waits                             等待MDL的會(huì )話(huà)

schema_table_statistics,x $ schema_table_statistics                            表統計信息

schema_table_statistics_with_buffer,x $ schema_table_statistics_with_buffer表統計信息,包含InnoDB緩沖池統計信息

schema_tables_with_full_table_scans,x $ schema_tables_with_full_table_scans全表訪(fǎng)問(wèn)的表

schema_unused_indexes                                                           沒(méi)有使用的索引

session,x $ session                                                          用戶(hù)會(huì )話(huà)的Processlis信息

session_ssl_status                                                                SSL連接信息

statement_analysis,x $ statement_analysis                                      SQL語(yǔ)句匯總信息統計

statements_with_errors_or_warnings,x $ statements_with_errors_or_warnings       含有錯誤和警告的SQL

statements_with_full_table_scans,x $ statements_with_full_table_scans            執行時(shí)候全表掃描的語(yǔ)句

statements_with_runtimes_in_95th_percentile,X $ statements_with_runtimes_in_95th_percentile平均運行時(shí)間很長(cháng)的SQL

statements_with_sorting,x $ statements_with_sorting                                       排序的SQL語(yǔ)句

statements_with_temp_tables,x $ statements_with_temp_tables                         使用臨時(shí)表的SQL玉溪

user_summary,x $ user_summary                                                       用戶(hù)語(yǔ)句和活動(dòng)連接信息

user_summary_by_file_io,x $ user_summary_by_file_io                                 用戶(hù)相關(guān)文件I / O信息

user_summary_by_file_io_type,x $ user_summary_by_file_io_type                         用戶(hù)相關(guān)文件FI / O類(lèi)型信息

user_summary_by_stages,x $ user_summary_by_stages                                     用戶(hù)階段事件和延遲信息

user_summary_by_statement_latency,x $ user_summary_by_statement_latency            以統計的SQL語(yǔ)句信息

user_summary_by_statement_type,x $ user_summary_by_statement_type                  按照用戶(hù)和事件(事件)已執行的SQL語(yǔ)句信息

wa_ wait_classes_global_by_avg_latency                                              事件類(lèi)型分類(lèi)的平均延遲

wait_classes_global_by_latency,x $ wait_classes_global_by_latency                  事件類(lèi)型的延遲統計

waits_by_host_by_latency,x $ waits_by_host_by_latency                              按照主機分類(lèi)的事件系想你

waits_by_user_by_latency,x $ waits_by_user_by_latency                              按用戶(hù)統計的事件

waits_global_by_latency,x $ waits_global_by_latency                              按事件統計的事件信息

免責聲明:本站發(fā)布的內容(圖片、視頻和文字)以原創(chuàng )、來(lái)自本網(wǎng)站內容采集于網(wǎng)絡(luò )互聯(lián)網(wǎng)轉載等其它媒體和分享為主,內容觀(guān)點(diǎn)不代表本網(wǎng)站立場(chǎng),如侵犯了原作者的版權,請告知一經(jīng)查實(shí),將立刻刪除涉嫌侵權內容,聯(lián)系我們QQ:712375056,同時(shí)歡迎投稿傳遞力量。

国产精品久久久久影院嫩草| 国语自产精品视频在 视频| 少妇高潮毛片免费看| 欧美天天综合色影久久精品| 无码专区久久综合久中文字幕| 免费人成视频在线|