زمان پاسخ (Responsive time) در اوراکل
ما دو نوع زمان پاسخ (Responsive time) داريم:
-
Application response time
-
PL/SQL response time
بصورت كلي ما مي توانيم از چند طريق در اوراکل اين زمان ها را بدست آوريم:
v$sysmetric, v$active_session_history, v$sqlarea and v$sysmetric_summary , v$sql
براي اولي (Application response time): شما مي توانيد tkprof utility اوراکل ، كه نتيجه بصورت يك فايل است و آنرا بايد بررسي كنيم.
براي دومي (PL/SQL response time) : اگر مي خواهيد زمان اجراي كوئري را در sqlplus در اوراکل مشاهده كنيد به ترتيب زير عمل مي كنيم.
SQL> set timing on;
SQL> select * from table ;
Elapsed: 00:00:01.20
SQL> select * from table ;
Elapsed: 00:00:01.20
اگر مي خواهيد در پروسيجر و يا در scope بدست آوريد به صورت زير عمل كنيد:
Declare
start_cpu_time NUMBER;
end_cpu_time NUMBER;
l_count NUMBER;
Begin
start_cpu_time := dbms_utility.GET_CPU_TIME;
/*
---
Your Query ...
---
select count(*) into l_count from test;
*/
end_cpu_time := dbms_utility.GET_CPU_TIME;
dbms_output.put_line('CPU Time (in seconds)= '|| ((end_cpu_time - start_cpu_time)/100));
End;
start_cpu_time NUMBER;
end_cpu_time NUMBER;
l_count NUMBER;
Begin
start_cpu_time := dbms_utility.GET_CPU_TIME;
/*
---
Your Query ...
---
select count(*) into l_count from test;
*/
end_cpu_time := dbms_utility.GET_CPU_TIME;
dbms_output.put_line('CPU Time (in seconds)= '|| ((end_cpu_time - start_cpu_time)/100));
End;