oracle - Would like to know more on dba_hist_sqlstat -
i'm using tables - dba_hist_sqlstat, dba_hist_snapshot , dba_hist_sqltext stats groups of similar sql statements on entire period of time since instance start up. found same sql_id belonging 2 different snapids (snapshots).
+-------+---------+---------------+-------------+---------------+--------------+--------------+ |snap_id|dbid |instance_number|sql_id |plan_hash_value|optimizer_cost|optimizer_mode| +-------+---------+---------------+-------------+---------------+--------------+--------------+ |63618 |622294766|1 |0ps2wsx1rjv8q|2871982686 |4 |all_rows | |63522 |622294766|1 |0ps2wsx1rjv8q|2871982686 |4 |all_rows | +-------+---------+---------------+-------------+---------------+--------------+--------------+
so, "group sql_id" sufficient ? should group "sql_text" ? there better way ?
[update]
here query i've written far -
select dh_sql.sql_id, dh_sql.plan_hash_value, dh_sql.parsing_schema_name, dh_sql.module, trunc(dh_snap.end_interval_time) "date", max(dh_sql.snap_id), max(dh_sql.dbid), sum(dh_sql.executions_delta), . . . . dba_hist_sqlstat dh_sql, dba_hist_snapshot dh_snap dh_sql.snap_id = dh_snap.snap_id , dh_snap.begin_interval_time > to_date(?, 'mm/dd/yyyy') , dh_snap.begin_interval_time < to_date(?, 'mm/dd/yyyy') + 1 , dh_sql.executions_delta > 0 , dh_sql.module not null group dh_sql.sql_id, dh_sql.plan_hash_value, dh_sql.parsing_schema_name, dh_sql.module, trunc(dh_snap.end_interval_time)
Comments
Post a Comment