关于sql语句load,reload, soft parse, hard parse 的理解的几个问题

[复制链接]
查看11 | 回复6 | 2007-9-26 18:42:10 | 显示全部楼层 |阅读模式
在一资料上看到如下一段对parse的解释:
所谓parse分soft parse 和hard parse,soft parse是当一条sql传进来后,需要在shared pool中找是否有相同的sql,如果找到了,那就是soft parse,如果没有找着,那就开始hard parse,实际上hard parse主要是检查该sql所涉及到的所有的对象是否有效以及权限等关系,hard parse之后才根据rule/cost模式生成执行计划,再执行sql。
我有几个问题:
1. soft parse所做的只是在shared pool中寻找相同的sql ,之后便execute;
2. 是否hard parse与 load/reload 是对应的,伴随发生的?;
3. reload又是因何产生的呢,为甚莫明明找到了sql , 却又reload?
请指教,谢谢!!!
回复

使用道具 举报

千问 | 2007-9-26 18:42:10 | 显示全部楼层
给你参考一下:
http://metalink.oracle.com/metal ... p_showHelp=1#bottom
回复

使用道具 举报

千问 | 2007-9-26 18:42:10 | 显示全部楼层
多谢大师指点
回复

使用道具 举报

千问 | 2007-9-26 18:42:10 | 显示全部楼层
我看不了上面链接的内容。
哪位大侠可以把里面的内容转贴出来共享一下,谢谢!
没有什么帐号是可以浏览的又不用付费的。
回复

使用道具 举报

千问 | 2007-9-26 18:42:10 | 显示全部楼层
PURPOSE ~~~~~~~ The document gives a overview of Parsing.SCOPE & APPLICATION ~~~~~~~~~~~~~~~~~~~ For users requiring a general overview of how parsing works. Introduction ============This article show the parsing mechanism as a flow diagram.Its main purpose is to show the difference between a 'soft' and a 'hard' parse.It is intended to give a feel of how parsing operates to makeexplanation of parsing activity easier. SQL Parsing Flow Diagram ======================== Statement Submitted|Is it in an open cursor?--------------YES----V |
|NO
| |
|Is SESSION_CACHED_CURSORS = Value
|and cursor in --------------YES----V In these 3 cases weSession Cursor cache?
| know that the cursor has |
| already been parsed, so NO
| re-parsing is|
| unnecessary.Is HOLD_CURSOR=Y
|and cursor in --------------YES----VHeld cursor cache?
| |
| NO
|
|
|
^OPEN A CURSOR
|CLIENT SIDE | |
| -------------|Statement is Hashed and compared
|SERVER SIDE | with the Hashed value in the sql area|
V|
VIs it in sql area? --YES-(Soft Parse)--> ---------|
| |NO
| EXECUTE ||
| |PARSE STATEMENT ('Hard' Parse)---------> ---------NOTES =====1. A cursor is an address on the client that points to the memorylocation of a SQL statement on the server.Multiple-client cursors may point at the same address on the server.2. Remember that 'Client' and 'Server' sides may reside on the same machine - in which case Client/Server is a logical distinction.3. If a cursor is open, then the statement will be in the sql_area, so no parsing is necessary. This is why locks may remain when a client is terminatedabnormally (such as a PC Client being turned off withoutclosing open cursors).4. SESSION_CACHED_CURSORS is the initialisation parameter thatspecifies how many cursors to hold open for a particular session.5. HOLD_CURSOR is an precompiler parameter that specifies that an individual cursor should be held open. See Page 11-3 of the Programmer's guide to the Oracle Precompilers.6. Both the soft and hard parse register as a parse in tkprof. Hashing thecurrent statement updates the parse count.7. Soft parse avoids many of the steps taken during the parse phase for a particular statement. Initial syntactic and semantic checks are made and then the statement is hashed and compared with hashed statements in the SQL area. If a match is found, then existing information is usedand relatively expensive steps (such as query optimization etc.) are avoided.8. The 10053 event is only invoked during a hard parse. Additional Search Words ~~~~~~~~~~~~~~~~~~~~~~~HARD; HOLD_CURSOR; PARSE; SESSION_CACHED_CURSORS; SOFT; SQL;---------------------------------------------------------------
不知道能不能很方便的看
回复

使用道具 举报

千问 | 2007-9-26 18:42:10 | 显示全部楼层
图片好看些
回复

使用道具 举报

千问 | 2007-9-26 18:42:10 | 显示全部楼层
parse过的cache没有的时候,有sql也要parse
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行