执行时间最长的20条SQL语句(按时间降序排列),可保存为脚本方便调用:
SELECT rows_read / (num_executions + 1) as avg_rows_read,
rows_written / (num_executions + 1) as avg_rows_written,
stmt_sorts / (num_executions + 1) as avg_sorts,
total_exec_time / (num_executions + 1) as avg_exec_time,
substr(stmt_text,1,1000) as SQL_Stmt
FROM SYSIBMADM.SNAPDYN_SQL ORDER BY avg_exec_time desc fetch first 20 rows only;
祝你学习愉快!