慢查詢日志分析工具-mysqldumpslow

mysql官方提供的慢查詢日志分析工具.主要功能是,

統計不同慢sql的出現次數(Count),執行最長時間(Time),累計總耗費時間(Time),等待鎖的時間(Lock),發送給客戶端的行總數(Rows),掃描的行總數(Rows),用戶以及sql語句本身(抽象了一下格式,比如limit 1, 20用limit N,N表示).

常用的參數:

-s排序選項:c:訪問計數l:鎖定時間r:返回記錄t:查詢時間al:平均鎖定時間ar:平均返回記錄數at:平均查詢時間 -t只顯示top n條查詢

[root@test-db01 ~]# mysqldumpslow -s l -t 3/application/mysql/data/mysql-slow.log

Reading mysql slow query log from/application/mysql/data/mysql-slow.log

Count: 4466Time=0.01s (26s)Lock=0.00s(1s)Rows=0.0 (2),lwl-ht[lwl-ht]@[192.168.10.33]

select transactionId,GroupId, transactionNo, contractId, contractNo, contractName, orderNo,

contractType,transferType, carryContractMethod, consignerID, consignerName, consignerUserId,

bussinessMode,biddingMode, businessStatus, platformId, supplierId, supplierName,

platformName,supplierUserId, promise, dealAmount, biddingQty, planOffLineDate,actOffLineDate,

contractLineId,contractLineNo, Etd, Eta, sourceLocationCode, sourceProvinceCode,

sourceCityCode,sourceCountyCode, sourceProvinceName, sourceCityName, sourceCountyName,

sourceLatitude,sourceAddress, sourceConnector, sourceConnectorMobile, targetLocationCode,

targetProvinceCode, targetCityCode, targetCountyCode,targetProvinceName, targetCityName,

targetCountyName,targetLatitude, targetAddress, targetConnector, targetConnectorMobile,

totalDistance,pickupQty, unloadQty, goodsCategory, goodsType, goodsName, goodsNorms,

goodsPack,goodsNumber, goodsTotalWeight, goodsMaxSingleVolumn, goodsMaxSingleWeight,

goodsTotalVolume,volumnUnit, weightUnit, lengthUnit, goodsValue, goodsRemark, vichleLimitCode,

boxCategory,boxType, boxLength, equipmmentQty, actDealDate, timelimitTypeValue,

timelimitType,remark, offerServices, addUser, addDate, modifyUser, modifyDate, unitPrice,

quotationUnit

fromcontract_contractbizheader

WHERE (bussinessMode = N

andbusinessStatus = N

andplanOffLineDate <= 'S' )

or(bussinessMode = N

andbusinessStatus = N

andplanOffLineDate <= 'S' )

or(bussinessMode = N

andbusinessStatus = N

andplanOffLineDate <= 'S' )

Count: 2233Time=0.01s (17s)Lock=0.00s(0s)Rows=0.0 (21),lwl-order[lwl-order]@[192.168.10.33]

select

orderId, orderNo,GroupId, supplierGroupId, consignerGroupId, orderType, orderStatus,

contractType,contractNos, transferMethod, refInfoNo, orderSource, consignerCompanyCode,

consignerCompanyName, platformOpenId, platformName, supplierCode,supplierName, supplierUserId,

requireFeedbakTime, actualFeedbackTime, etd, eta, atd, ata,sourceLocationCode, sourceProvinceName,

sourceProvinceCode, sourceCityName, sourceCityCode, sourceCountyName,sourceCountyCode,

sourceAddress,sender, senderMobile, senderTel, sourceLocationQty, sourceLatitude,

targetLocationCode, targetProvinceName, targetProvinceCode, targetCityName,targetCityCode,

targetCountyName,targetCountyCode, targetAddress, receiver, receiverMobile, receiverTel,

targetLocationQty, targetLatitude, vichleLimitCode, boxCategory,boxType, boxLength,

equipmmentQty,goodsCategory, goodsType, goodsName, goodsNorms, goodsPack, goodsNumber,

goodsTotalWeight,goodsMaxSingleVolumn, goodsMaxSingleWeight, goodsTotalVolume, volumnUnit,

weightUnit,lengthUnit, goodsValue, goodsRemark, serviceConstraints, podReturnMethod,

billPeriodCode,payMethodCode, donePayCost, billTermsCode, totalCost, prePayCost,

prePayMethodCode,prePaySatus, isNeedInvoice, invoiceType, taxRate, planConfirmDate,

confirmDate,remark, addUser, addDate, modifyUser, modifyTime

fromorder_orderinfo

WHERE (orderStatus = N )

or(orderStatus = N )

or(orderStatus = N )

Count: 10636Time=0.00s (41s)Lock=0.00s(0s)Rows=0.2 (2209),lwl-com[lwl-com]@[192.168.10.33]

select

DictionaryId,ParentId, Code, Name, Description, Url, Sort, AddOpenId, AddDate, UpdateOpenId,

UpdateDate,DictionaryType

from dictionary

WHERE (Code = 'S' )

[root@test-db01 ~]#

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容