pkg cache stmt包羅永珍
--執行時間長的SQL
select stmt_exec_time, num_executions, stmt_text
from table(mon_get_pkg_cache_stmt(null,null,null,-2)) as s
order by stmt_exec_time desc fetch first 5 rows only;
--CPU時間消耗高的SQL
select stmt_exec_time, num_executions,
(total_cpu_time / 1000) as cpu_time,
stmt_text
from table(mon_get_pkg_cache_stmt(null,null,null,-2)) as s
order by cpu_time desc fetch first 5 rows only;
--IO消耗高的SQL
select stmt_exec_time, num_executions,
(pool_read_time + pool_write_time +
direct_read_time + direct_write_time) as io_time,
stmt_text
from table(mon_get_pkg_cache_stmt(null,null,null,-2)) as t
order by io_time desc fetch first 5 rows only;
--等待時間長的SQL
select total_act_time, total_act_wait_time,
(case when total_act_time > 0
then ((total_act_time - total_act_wait_time) * 100
/ total_act_time)
else 100
end) as relvelocity,
stmt_text
from table (mon_get_pkg_cache_stmt(null,null,null,-2)) as t
order by relvelocity fetch first 5 rows only;
--讀選比大的SQL
select rows_returned, rows_read,
(case when rows_returned > 0
then rows_read / rows_returned
else 0
end) as ratio,
stmt_text as stmt
from table(mon_get_pkg_cache_stmt(null,null,null,-2)) as p
order by ratio desc
fetch first 10 rows only;
--某個SQL的消耗,時間都花在哪些地方了
select p.executable_id, r.metric_name, r.parent_metric_name,
r.total_time_value as time, r.count, p.member
from
(select stmt_exec_time, executable_id
from table(mon_get_pkg_cache_stmt(null,null,null,-2)) as s
order by stmt_exec_time desc fetch first row only) as stmts,
table(mon_get_pkg_cache_stmt_details(null,
stmts.executable_id,
null,
-2)) as p,
table(mon_format_xml_times_by_row(p.details)) as r
order by stmts.executable_id, parent_metric_name desc;
--DB2不斷推出新的監控指標
select
total_backup_time,total_backup_proc_time,total_backups,
total_index_build_time,total_index_build_proc_time,total_indexes_built,
total_col_time,total_col_proc_time
FROM TABLE(MON_GET_CONNECTION(cast(NULL as bigint), -2)) AS t
fetch first 1 rows only with ur;
--Assessing Efficiency of Columnar Query
--Compute the ratio of columnar processing time to overall section processing time to see how much we’re leveraging the columnar runtime
SELECT TOTAL_SECTION_TIME, TOTAL_COL_TIME,
DEC((FLOAT(TOTAL_COL_TIME)/
FLOAT(NULLIF(TOTAL_SECTION_TIME,0)))*100,5,2)
AS PCT_COL_TIME
FROM TABLE(MON_GET_PKG_CACHE_STMT(NULL,NULL,NULL,-1)) AS T
WHERE STMT_TEXT = 'SELECT * FROM TEST.COLTAB A, TEST.ROWTAB B WHERE A.ONE = B.ONE';
--監控排序記憶體使用
SELECT SORT_SHRHEAP_ALLOCATED, -- current
SORT_SHRHEAP_TOP, -- high watermark
SORT_CONSUMER_SHRHEAP_TOP -- per consumer hwm
FROM TABLE(MON_GET_DATABASE(-1));
SELECT SORT_SHRHEAP_ALLOCATED,
SORT_SHRHEAP_TOP,
SORT_CONSUMER_SHRHEAP_TOP
FROM TABLE(MON_GET_PKG_CACHE_STMT(NULL,NULL,NULL,-1)) AS T;
MON_GET_DATABASE(Database level)
MON_GET_PKG_CACHE_STMT(Query level)
MON_GET_SERVICE_SUBCLASS_STATS(Subclass level)
db2 "describe select * from TABLE(MON_GET_PKG_CACHE_STMT(NULL,NULL,NULL,-1))" | grep -i sort
db2 "describe select * FROM TABLE(MON_GET_DATABASE(-1))" | grep -i sort
db2 "describe select * FROM TABLE(MON_GET_SERVICE_SUBCLASS_STATS(CAST(NULL AS VARCHAR(128)),CAST(NULL AS VARCHAR(128)), -2))" | grep -i sort
--排序溢位
WITH SORT_CONSUMERS(TOTAL_SORT_CONSUMERS,
TOTAL_SORT_CONSUMER_OVERFLOWS)
AS (SELECT (TOTAL_SORTS + TOTAL_HASH_JOINS +
TOTAL_HASH_GRPBYS + TOTAL_OLAP_FUNCS + TOTAL_COL_VECTOR_CONSUMERS)
AS TOTAL_SORT_CONSUMERS,
(SORT_OVERFLOWS + HASH_JOIN_OVERFLOWS +
HASH_GRPBY_OVERFLOWS + OLAP_FUNC_OVERFLOWS)
AS TOTAL_SORT_CONSUMER_OVERFLOWS
FROM TABLE(MON_GET_DATABASE(-2)) AS T)
SELECT TOTAL_SORT_CONSUMER_OVERFLOWS,
TOTAL_SORT_CONSUMERS,
CASE WHEN TOTAL_SORT_CONSUMERS > 0 THEN
DEC((FLOAT(TOTAL_SORT_CONSUMER_OVERFLOWS)/
FLOAT(TOTAL_SORT_CONSUMERS)) * 100, 5, 2)
ELSE
NULL
END AS PCT_SORT_CONSUMER_OVERFLOWS
FROM SORT_CONSUMERS
WITH UR;
with ops as
( select
(total_sorts + total_hash_joins + total_hash_grpbys)
as sort_ops,
(sort_overflows + hash_join_overflows + hash_grpby_overflows)
as overflows,
sort_shrheap_top as sort_heap_top
from table(mon_get_database(-2)))
select sort_ops,
overflows,
(overflows * 100) / nullif(sort_ops,0) as pctoverflow,
sort_heap_top
from ops;
--監控查詢使用的排序情況
SELECT SORT_SHRHEAP_TOP,
SORT_CONSUMER_SHRHEAP_TOP,
ACTIVE_SORT_CONSUMERS_TOP,
NUM_EXECUTIONS,
(TOTAL_SORTS +
TOTAL_HASH_JOINS +
TOTAL_HASH_GRPBYS +
TOTAL_COL_VECTOR_CONSUMERS) AS SORT_OPS,
(SORT_OVERFLOWS +
HASH_JOIN_OVERFLOWS +
HASH_GRPBY_OVERFLOWS) AS SORT_OVERFLOWS,
(POST_THRESHOLD_SORTS +
POST_THRESHOLD_HASH_JOINS +
POST_THRESHOLD_HASH_GRPBYS +
POST_THRESHOLD_COL_VECTOR_CONSUMERS) AS THROTTLED_SORT_OPS,
SUBSTR(STMT_TEXT,1,255) AS STMT_TEXT
FROM TABLE(MON_GET_PKG_CACHE_STMT(NULL,NULL,NULL,-2));
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/725820/viewspace-2217918/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 包羅永珍的結構體 -- 就要學習 Go 語言結構體Go
- 永珍奧科嵌入式核心板解決方案!
- 網易遊戲520:多元文化創想永珍熱愛遊戲
- 羅永浩萬字求職信求職
- 永珍革新,開啟鴻蒙原生應用生態新篇章鴻蒙
- 武漢永珍奧科:嵌入式開發的三種方案!
- macOS monterey 12系統離線pkg安裝包Mac
- 騰訊雲資料永珍內容稽核詳細步驟(JAVA版)Java
- 有獎徵文活動:從 RTC 到 RTE,從音影片到「實時永珍」!
- vPaaS低程式碼音視訊工廠:極速智造,永珍空間
- 永珍奧科全新發布瑞薩G2L平臺核心板
- 六大趨勢,發現2019網際網路產業永珍新生產業
- 武漢永珍奧科:記憶體壓力測試工具memtester使用指南記憶體
- pkg-config
- 智領,永珍新生:智譜AI推動大模型商業化邁向新階段AI大模型
- 一元初始 永珍融合 - Google Cloud 2022 中國出海數字峰會回顧GoCloud
- 關於你看得懂看不懂的羅永浩。
- 羅永浩“讓人尿褲子”的產品釋出!
- 雷蛇 | AMD 解鎖新地標,雷蛇授權體驗店·成都永珍店正式開業!
- 打破策略對戰玩法常規印象,王者榮耀IP新遊《王者永珍棋》CG公佈
- 【JAVA今法修真】 第一章 今法有永珍 百家欲爭鳴Java
- MacOS 11-14(PKG系統安裝包及IPSW韌體) 通用版Mac
- 羅永浩公司申請交個朋友商標被駁回
- 羅永浩微博盛讚OPPO Find X:真的很了不起
- PKG系統安裝包及IPSW韌體:MacOS 11-14 Sonoma 正式版Mac
- go呼叫python報錯pkg-config: exec: "pkg-config": executable file not found in %PATH%GoPython
- ACOUG 聯合創始人蓋國強:永珍更新,資料庫技術和生態的發展演進資料庫
- fribidi not found using pkg-config
- 堅果3“涼了”,羅永浩只提了一次人工智慧人工智慧
- 千億天美的珍瓏棋局
- 羅永浩又發微博了!“AR創業”會再度陷入魔咒嗎?創業
- 安永:俄羅斯國際業務發展前景報告(附下載)
- macos14下載-macOS 14 Sonoma 14.1.1正式版(最新MacOS系統) pkg完整安裝包Mac
- 大牌高仿包聖羅蘭高仿包包多少錢
- 善珍:2021年中國銀髮人群體檢現狀資料包告(附下載)
- 小葫蘆直播資料 :2020年4月10號羅永浩直播資料
- 2020年11月羅永浩直播帶貨單月GMV高達5.2億元
- 永珍奧科Cortex-A55核心板全新上市!工業級品質,1G記憶體+8G儲存!記憶體