I got rid of the old sqlstat.sql, sqlstat2.sql and sqlstat3.sql scripts in my GitHub repository and fixed an issue that was in sqlstat3.sql. Now the current version is just called sqlstat.sql. This one script should work well in all the situations where the other three were useful. (One script to rule them all…)
The old version of sqlstat3.sql was showing rows with plans that were not being run so I added a condition to only show plans that actually had any elapsed time. Slowly getting more useful.
Old output:
SQL_ID PLAN_HASH_VALUE END_INTERVAL_TIME EXECUTIONS_DELTA
------------- --------------- ------------------------- ----------------
g0wqzdhxy62mc 2903317857 14-APR-20 01.00.04.320 PM 0
g0wqzdhxy62mc 4109593498 14-APR-20 01.00.04.320 PM 440
g0wqzdhxy62mc 1569680226 14-APR-20 01.00.04.320 PM 0
g0wqzdhxy62mc 2845678604 14-APR-20 01.00.04.320 PM 0
New output:
SQL_ID PLAN_HASH_VALUE END_INTERVAL_TIME EXECUTIONS_DELTA
------------- --------------- ------------------------- ----------------
g0wqzdhxy62mc 4109593498 14-APR-20 01.00.04.320 PM 440
I really was not using the other two scripts anymore and was only using sqlstat3.sql. They are in the GitHub history if anyone needs to revisit them. Going forward I will use the new sqlstat.sql.
Bobby
Pingback: Long running queries and my DBA_HIST_SQLSTAT scripts | Bobby Durrett's DBA Blog
Pingback: Query Plan Change Diagnosis Example | Bobby Durrett's DBA Blog