`
itspace
  • 浏览: 960998 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

Oracle cursor_shring,histograms,sql explain

阅读更多
今天在看一本书,看到这么一句话,醍醐灌顶啊,记录之
  The problem related to the value force is that a single child cursor is used for all SQL statements sharing the same text after the replacement of the literals. Consequently, the literals (that are essential for taking advantage of histograms) are peeked only during the generation of the execution plan related to the first submitted SQL statement. Naturally, this could lead to suboptimal execution plans because literals used in subsequent SQL statements will lead to different execution plans. To avoid this problem, the value similar is available. In fact, it checks whether a histogram exists for one of the replaced literals, before reusing a cursor that is already available. If it does exist, a new child cursor is created. If it does not exist, an already available child cursor will be used.
  In summary, if an application uses literals and cursor sharing is set to similar, the behavior depends on the existence of relevant histograms. If they do exist, similar behaves like exact. If they don’t exist, similar behaves like force. This means that if you are facing parsing problems, more often than not, it is pointless to use similar.
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics