SQLの実行時間を測る
db2batchを使って簡単に計測できます。
$ echo "<SQL>" | db2batch -d <データベース名>
具体的には次のような感じ。
$ echo "select * from hoge_table;" | db2batch -d foodb
実行結果です。
...省略(SQLの実行結果がつらつらと表示されます。) * Elapsed Time is: 0.000864 seconds * Summary Table: Type Number Repetitions Total Time (s) Min Time (s) Max Time (s) Arithmetic Mean Geometric Mean Row(s) Fetched Row(s) Output --------- ----------- ----------- -------------- -------------- -------------- --------------- -------------- -------------- ------------- Statement 1 1 0.000864 0.000864 0.000864 0.000864 0.000864 28 28 * Total Entries: 1 * Total Time: 0.000864 seconds * Minimum Time: 0.000864 seconds * Maximum Time: 0.000864 seconds * Arithmetic Mean Time: 0.000864 seconds * Geometric Mean Time: 0.000864 seconds --------------------------------------------- * Timestamp: 金 8月 01 2008 20:58:02 JST
$ db2batch -d foodb -f <テキストファイルのパス>
でもOK。
その他詳細は
$ db2batch -h
を参照。