MybatisPlus效能分析外掛程式

2021-10-08 12:33:07 字數 1278 閱讀 3371

效能分析***,用於輸出每條 sql 語句及其執行時間

sql 效能執行分析,開發環境使用,超過指定時間,停止執行。有助於發現問題

(1)引數說明

引數:maxtime: sql 執行最大時長,超過自動停止執行,有助於發現問題。

引數:format: sql是否格式化,預設false。

(2)在 mybatisplusconfig 中配置

/**

* sql 執行效能分析外掛程式

* 開發環境使用,線上不推薦。 maxtime 指的是 sql 最大執行時長

* * 三種環境

* * dev:開發環境

* * test:測試環境

* * prod:生產環境

*/@bean

@profile()// 設定 dev test 環境開啟

public performanceinterceptor performanceinterceptor()

(3)spring boot 中設定dev環境

#環境設定:dev、test、prod

spring.profiles.active=dev

也可以自定義環境名稱:如test1、test2

(1)常規測試

/**

* 測試 效能分析外掛程式

*/@test

public void testperformance()

(2)將maxtime 改小之後再次進行測試

performanceinterceptor.setmaxtime(5);//ms,超過此處設定的ms不執行
如果執行時間過長,則丟擲異常:the sql execution time is too large, 

1、delete

2、selectone

3、selectcount

4、selectlist

5、selectmaps

6、selectobjs

7、update

mybatis plus效能分析外掛程式

效能分析外掛程式能夠很好的分析每條sql語句執行的時間,以至於我們可以去進行sql優化 我們只需要在配置類中新增 sql 執行效能分析外掛程式 開發環境使用,線上不推薦。maxtime 指的是 sql 最大執行時長 dev 開發環境 test 測試環境 prod 生產環境 bean profile ...

MybatisPlus中的效能分析外掛程式

目錄 效能分析外掛程式 開啟外掛程式 測試 類似於mysql內建的explain和擴充套件的showprofile,druid等,mybatis plus內建了效能分析外掛程式,這個效能分析外掛程式需要你開啟,它會在程式執行時列印在控制台上 1.首先在config檔案中新增 bean,開啟外掛程式 ...

mysql 效能分析 Mysql效能分析

優化mysql資料庫效能的十個引數 1 max connections 允許的同時客戶的數量。增加該值增加 mysqld 要求的檔案描述符的數量。這個數字應該增加,否則,你將經常看到 too many connections 錯誤。預設數值是100,我把它改為1024 2 record buffer...