Percona Toolkit工具包的使用教程之效能類工具

來源:互聯網
上載者:User

percona-toolkit工具包的使用教程之效能類工具

1.  pt-index-usage

功能介紹:

從log檔案中讀取插敘語句,並用explain分析他們是如何利用索引。完成分析之後會產生一份關於索引沒有被查詢使用過的報告。

用法介紹:

pt-index-usage [OPTION...] [FILE...]

可以直接從慢查詢中擷取sql,FILE檔案中的sql格式必須和慢查詢中個是一致,如果不是一直需要用pt-query-digest轉換一下。也可以不產生報告直接儲存到資料庫中,具體的見後面的樣本

使用樣本:

從滿查詢中的sql查看索引使用方式範例:

pt-index-usage /data/dbdata/localhost-slow.log --host=localhost --user=root --password=zhang@123

將分析結果儲存到資料庫範例:

pt-index-usage /data/dbdata/localhost-slow.log --host=localhost --user=root --password=zhang@123  --no-report --create-save-results-database

使用--create-save-results-database會自動產生資料庫和表來儲存結果。

2. pt-pmp

功能介紹:

為查詢程式執行彙總的GDB堆疊追蹤,先進性堆疊追蹤,然後將跟蹤資訊匯總。

用法介紹:

pt-pmp [OPTIONS] [FILES]

使用樣本:

pt-pmp -p 21933

pt-pmp -b /usr/local/mysql/bin/mysqld_safe

3. pt-visual-explain

功能介紹:

格式化explain出來的執行計畫按照tree方式輸出,方便閱讀。

用法介紹:

pt-visual-explain [OPTION...] [FILE...]

option請參閱官方網站,這裡不一一例舉!

使用樣本:

查看包含explain結果的aaa檔案的範例:

pt-visual-explain  aaa

查看包含查詢語句的aaa檔案的範例:

pt-visual-explain --connect aaa --user=root --password=zhang@123

通過管道直接查看explain輸出結果的範例:

mysql -uroot -pzhang@123  -e "explain select email from test.collect_data where id=101992419" |pt-visual-explain

Percona Toolkit 的詳細介紹:請點這裡
Percona Toolkit 的:請點這裡

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.