Db2表函数MON_GET_PKG_CACHE_STMT中INSERT_TIMESTAMP含义

问题

根据DB2信息中心的描述,MON_GET_PKG_CACHE_STMT中INSERT_TIMESTAMP含义如下

The insert_timestamp monitor element stores the time when the statement or section was inserted into the cache. For dynamic sql snapshots this represents the time when the statement entered the cache. For MON_GET_PKG_CACHE_STMT, MON_GET_PKG_CACHE_STMT_DETAILS and the package cache event monitor, the value is more granular and represents the time when an individual section for this statement was inserted into the cache.

对于一条SQL语句来讲,如果只执行一次,那么INSERT_TIMESTAMP是指SQL开始时间还是结束时间?如果是开始时间,那么在SQL结束之前TOTAL_ACT_TIME和NUM_EXECUTIONS是多少呢?

经过验证,一旦SQL语句开始执行(假设是第一次执行),那么package cache中就有相关的信息了,insert_timestamp就是SQL开始执行时间,在执行完成之前,TOTAL_ACT_TIME和NUM_EXECUTIONS都是0。当执行完成后,NUM_EXECUTIONS变为1。

这也是为什么我们查看MON_GET_PKG_CACHE_STMT时,有些SQL语句的NUM_EXECUTIONS是0。

猜你喜欢

转载自blog.csdn.net/qingsong3333/article/details/104729626