A long-running query that spans multiple snapshots will appear to have execution time without any executions, if you only look at a single snapshot. Otherwise the sum of EXECUTIONS_DELTA would be incorrect.
In one session, create a table and start a long-running query:
create table test3 as
select level a from dual connect by level <= 100000;
select count(*) from test3 cross join test3 cross join test3;
While that's running, open another session and create multiple snapshots:
begin
dbms_workload_repository.create_snapshot;
dbms_lock.sleep(5);
dbms_workload_repository.create_snapshot;
end;
/
Use V$SQL to find the SQL_ID, but it will be the same as below if you use the exact same text as above. The query execution is only counted in one snapshot, but the time is recorded in two snapshots.
select sql_id, plan_hash_value, snap_id,
sum(executions_delta),
sum(elapsed_time_delta)
from dba_hist_sqlstat
where sql_id = '09pgf63pczkxg'
group by sql_id, plan_hash_value, snap_id;
SQL_ID PLAN_HASH_VALUE SNAP_ID SUM(EXECUTIONS_DELTA) SUM(ELAPSED_TIME_DELTA)
09pgf63pczkxg 3377121179 5570 1 22001734
09pgf63pczkxg 3377121179 5571 0 6010267