( Session Cached Cursor 테스트 )
SQL> alter session set session_cached_cursors=10 ;
Session altered
SQL> alter system flush shared_pool ;
System altered.
SQL> select * from emp where empno=7788 ;
...
SQL> select parse_calls, users_opening, users_executing from v$sql
2 where sql_text='select * from emp where empno=7788 ';
PARSE_CALLS USERS_OPENING USERS_EXECUTING
\--------\--\- --\--------\--\- --\------------\-
1 0 0
SQL> select * from emp where empno=7788 ;
...
SQL> select parse_calls, users_opening, users_executing from v$sql
2 where sql_text='select * from emp where empno=7788 ';
PARSE_CALLS USERS_OPENING USERS_EXECUTING
\--------\--\- --\--------\--\- --\------------\-
2 0 0
SQL> select * from emp where empno=7788 ;
...
SQL> select parse_calls, users_opening, users_executing from v$sql
2 where sql_text='select * from emp where empno=7788 ';
PARSE_CALLS USERS_OPENING USERS_EXECUTING
\--------\--\- --\--------\--\- --\------------\-
3 1 0
( Session Cached Cursor hits 테스트 )
SQL> select a.name, b.value
2 from v$statname a, v$mystat b
3 where a.name in ('session cursor cache hits','parse count (total)')
4 and b.statistic#=a.statistic# ;
NAME VALUE
\--------------------------------------------------------\--\- --\-------\-
session cursor cache hits 312
parse count (total) 186
SQL> declare
2 i number;
3 begin
4 for i in 1..10000
5 loop
6 execute immediate 'insert into t values(' \|\| mod(i,100) \|\|')';
7 end loop;
8 commit ;
9 end ;
10 /
PL/SQL procedure successfully completed.
SQL> select a.name, b.value
2 from v$statname a, v$mystat b
3 where a.name in ('session cursor cache hits','parse count (total)')
4 and b.statistic#=a.statistic# ;
NAME VALUE
\-------------------------------------------------------\--\- --\-------\-
session cursor cache hits 312
parse count (total) 10197
SQL> alter session set session_cached_cursors = 100 ;
Session altered.
SQL> declare
2 i number ;
3 begin
4 for i in 1..10000
5 loop
6 execute immediate 'insert into t values (' \|\| mod(i, 100) \|\| ')';
7 end loop ;
8 commit ;
9 end ;
10 /
PL/SQL procedure successfully completed.
SQL> select a.name, b.value
2 from v$statname a, v$mystat b
3 where a.name in ('session cursor cache hits','parse count (total)')
4 and b.statistic#=a.statistic# ;
NAME VALUE
\------------------------------------------------------\--\- --\-------\-
session cursor cache hits 9715
parse count (total) 20209
- 강좌 URL : http://www.gurubee.net/lecture/3038
- 구루비 강좌는 개인의 학습용으로만 사용 할 수 있으며, 다른 웹 페이지에 게재할 경우에는 출처를 꼭 밝혀 주시면 고맙겠습니다.~^^
- 구루비 강좌는 서비스 제공을 위한 목적이나, 학원 홍보, 수익을 얻기 위한 용도로 사용 할 수 없습니다.