您的位置:首页 > 其它

Parent and child cursors in the library cache

2009-10-06 11:24 411 查看
refer: http://www.ixora.com.au/q+a/0104/19005414.htm

From:Steve Adams
Date:19-Apr-2001 00:54
Subject: Parent and child cursors in the library cache

Firstly, please review the answer What are versions of an SQL statement?.

For each SQL statement the library cache contains a "parent" cursor for the text of the SQL statement. The parent cursor is comprised of a "handle" that can be looked up by hash value via the library cache hash table, and an "object" that contains pointers to each of its "child" cursors. Each child cursor is also comprised of a handle and an object. The child object is comprised of two heaps numbered 0 and 6. Heap 0 contains all the identifying information for a particular version of the SQL statement and heap 6 contains the execution plan. This distinction between parent and child cursors is maintained even when there is only one version of each SQL statement.

For parent cursors the convention used in the X$ tables is that the parent address is the same as the handle address. V$OPEN_CURSORS, V$SQL and so on are only interested in child cursors and so they exclude parent cursors by requiring that the two addresses are different. The columns that you mentioned are of course the two addresses.


I'm trying to play with X$KGLLK fixed table. But I can't understand the difference between the columns KGLLKHDL and KGLHDPAR. I've found in the view definition V$OPEN_CURSOR that to get the cursor list, Oracle selects rows where KGLLKHDL <> KGLHDPAR. But if I query all rows for particular transaction I can see 2 rows for the same cursor - first row with KGLLKHDL=KGLHDPAR and second row with KGLLKHDL <> KGLHDPAR.

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐