By Franck Pachot
.
A question that I had several times: in Enterprise Manager, in the screen about one SQL statement, the ‘statistics’ tab shows the number of executions, elapsed time, etc. Question is: which time window does it cover? There is a one hour chart above, and two timestamps displayed as ‘First Load Time’ and ‘Last load Time’, and we don’t know which one is related with the execution statistics numbers. I’ll explain it clearly on an example.
I’ll check a query I have on my system which has several cursors, with two different execution plans. And I check from V$SQL because here is where is the most detailed information, and columns are well documented.
From the documentation:
- FIRST_LOAD_TIME is the Timestamp of the parent creation time
- LAST_LOAD_TIME is the Time at which the query plan was loaded into the library cache
It’s clear that because V$SQL show information about child cursors, the FIRST_LOAD_TIME will be the same for all children.
SQL> select sql_id,plan_hash_value,executions,first_load_time,last_load_time,last_active_time from v$sql where sql_id='dcstr36r0vz0d' order by child_number SQL_ID PLAN_HASH_VALUE EXECUTIONS FIRST_LOAD_TIME LAST_LOAD_TIME LAST_ACTIVE_TIME ------------- --------------- ---------- ------------------- ------------------- ------------------- dcstr36r0vz0d 17720163 60 2014-10-29/07:01:59 2014-10-29/07:01:59 2014-10-29/13:01:25 dcstr36r0vz0d 3798950322 102 2014-10-29/07:01:59 2014-10-29/07:03:49 2014-10-29/13:05:54 dcstr36r0vz0d 3798950322 24 2014-10-29/07:01:59 2014-10-29/07:05:55 2014-10-29/13:05:54 dcstr36r0vz0d 3798950322 1 2014-10-29/07:01:59 2014-10-29/08:11:19 2014-10-29/08:11:19 dcstr36r0vz0d 3798950322 1 2014-10-29/07:01:59 2014-10-29/08:29:34 2014-10-29/08:29:34
The plan with hash value 17720163 has been executed 60 times since 07:01:59. It was the first child cursor (child_number=0) for that parent, so this is why FIRST_LOAD_TIME=LAST_LOAD_TIME
And, the plan with hash value 3798950322 has been executed 128 times since 07:03:49 by cursors that are not shared but have come to the same plan anyway
Two remarks:
- FIRST_LOAD_TIME is the same for all children because it is a parent information
- LAST_LOAD_TIME is different for each child and that’s important because Enterprise Manager don’t show that detail, aggregating together the children with same execution plan.
- ‘Last Load Time’ is not useful to know the time window covered by the Real Time statistics. Use First ‘Load time instead’
- In case of any doubt, fall back to V$ views which are much more documented, and give more detail.