Oracle query execution time

后端 未结 4 581
暖寄归人
暖寄归人 2021-01-03 18:31

I would like to get the query execution time in Oracle. I don\'t want the time Oracle needs to print the results - just the execution time.

In MySQL it is easy to ge

4条回答
  •  一向
    一向 (楼主)
    2021-01-03 18:43

    Use:

    set serveroutput on
    variable n number
    exec :n := dbms_utility.get_time;
    select ......
    exec dbms_output.put_line( (dbms_utility.get_time-:n)/100) || ' seconds....' );
    

    Or possibly:

    SET TIMING ON;
    
    -- do stuff
    
    SET TIMING OFF;
    

    ...to get the hundredths of seconds that elapsed.

    In either case, time elapsed can be impacted by server load/etc.

    Reference:

    • ASKTOM - SET TIMING ON/OFF

提交回复
热议问题