Analisi query tempo

Da wiki.gienne.cloud.
col program format a30
set linesize 100
set pagesize 0
select * from (
select query_runs.*,
                round ( (end_time - start_time) * 24, 2) as duration_hrs
           from (  select u.username,
                          ash.program,
                          ash.sql_id,
                          ash.sql_plan_hash_value as plan_hash_value,
                          ash.session_id as sess#,
                          ash.session_serial# as sess_ser,
                          cast (min (ash.sample_time) as date) as start_time,
                          cast (max (ash.sample_time) as date) as end_time
                     from dba_hist_active_sess_history ash, dba_users u
                    where u.user_id = ash.user_id 
                 group by u.username,
                          ash.program,
                          ash.sql_id,
                          ash.sql_plan_hash_value,
                          ash.session_id,
                          ash.session_serial#) query_runs
													order by sql_id, start_time) where DURATION_HRS >1 and USERNAME not like 'SYS' and USERNAME not like 'DBSNMP';

Analisi con query fatte da SqlPlus:

set timing on;