Home > database > Article is a great god, and how to view a SQL statement execution time point of the DB2
Article is a great god, and how to view a SQL statement execution time point of the DB2
Time:09-28
Article is a great god, and how to view a SQL statement execution time point of the DB2? Database performance problems, have found suspicious of SQL, want to make sure whether the SQL when performance problems in execution,
CodePudding user response:
1, analyze the execution efficiency of SQL statements: The SELECT rows_read/(num_executions + 1) as avg_rows_read, Rows_written/(num_executions + 1) as avg_rows_written, As avg_sorts stmt_sorts/(num_executions + 1), As avg_exec_time total_exec_time/(num_executions + 1), Substr (stmt_text, 1100, 0) as SQL_Stmt The FROM SYSIBMADM. SNAPDYN_SQL ORDER BY avg_exec_time desc The fetch first 10 rows only; # # field explain Num_executions statement execution times Avg_exec_time average execution time SQL_Stmt statement content capture
2, check a SQL: execution, Using Linux console, Writing SQL to be analysed in the sample. SQL file, multiple SQL using a semicolon, Perform the db2batch - d dbname - f sample. SQL & gt; Sample. The log To view the sample. The log can, including content, statement execution, the execution results, as well as various time, Also can call Windows environment db2cmd should, in DB2 bin directory search,