|
原帖由 Yong Huang 于 2011-8-19 01:14 发表 ![]()
Thanks for the test. Some of your wording may need to be changed.
> 在while循环中,parse 增加一次,execute 为99次。
> no parse 发生在同一个 transaction 中; 在sqlplus 中,单独的去执行语句,oracle认为是不同的transaction ,所以每次都会增加soft parse .
It's not transaction. It's the execution context, SQL vs. PL/SQL. Inside a PL/SQL block, the cursor is internally kept open in the session's private memory (UGA), as long as you didn't disable session cursor cache.
> 看到oracle因为编译环境的变化,认为是个新的sql, 重新分配sql area 。 看到由于session_cache_cursor 的关系,
> 导致产生了98 次soft parse + 1次 hard parse。
I tested your code. A new cursor is created and v$sql_shared_cursor indicates the reason is TOP_LEVEL_RPI_CURSOR, which I don't fully understand. RPI is short for "Recursive Program Interface", basically a software layer for recursive calls. Disabling session cursor cache causes a new type of recursive call? Maybe. But I don't know the details.
Yong Huang
Thanks your comment. I thought about sql area but didn't look at related view.
I will do advanced test if I am avaiable today.
Thanks again. |
|