| ANNOUNCEMENT: Deprecating the cursor_sharing = 'SIMILAR' setting [ID 1169017.1] | |||||
|
| |||||
| Modified 22-NOV-2011 Type ANNOUNCEMENT Status PUBLISHED | |||||
In
this Document
What
is being announced?
What
do you need to do?
References
We recommend that customers discontinue setting cursor_sharing = SIMILAR due to the many problematic situations customers have experienced using it. The ability to set this will be removed in version 12 of the Oracle Database (the settings of EXACT and FORCE will remain available). Instead, we recommend the use of Adaptive Cursor Sharing in 11g.
A number of customers have seen an increase in the number of child cursors since migrating to Oracle Database 11g Release 2. This can lead to many problems including complete CPU saturation of a machine requiring a database instance bounce or general database performance issues in the form. of waits on mutexes and 'library cache lock'.
From
Oracle versions 9.0 through 11.1, an oracle instance would limit the number
child cursors in the shared pool associated with a single parent to 1024 before
it would mark the parent OBSOLETE effectively invalidating it and all the
children. Then a new parent with one child would be created and used going
forward. But this would only limit the degradation of performance for some
environments rather than fix something that could be addressed more effectively
through improved application coding. (The attempt to address this from the
database side also introduced other issues like bug 5177766). The child limit
was removed by Oracle development because it was only masking an application
problem at the expense of database performance for better designed applications.
In addition, the obsolete code would not work in cases when SQL was wrapped
within PL/SQL. The fundamental problem that obsolete code was masking is
application code that was written incorrectly with regards to the ability to be
shared. For example, it is not written with user binds or the literal
characteristics differ to a high degree.
Therefore,
setting cursor_sharing = SIMILAR is highly discouraged in Oracle Database 11g
Release 2 (and generally has not been recommended for most environments even in
earlier versions) for several reasons:
1)
This parameter is generally overly restrictive in what it actually allows to be
shared. SIMILAR tells oracle to try and share cursors by replacing all literals
with binds for legacy applications, but directs that sharing only be performed
when all the replaced literal values were exactly the same (in the case of
predicates referencing columns with histograms or using inequality operators
such as BETWEEN, <, and !=)
2)
This parameter seems to bypass a lot of the improvements made with Oracle
Database 11g Adaptive Cursor Sharing feature and other abilities in the Cost
Based Optimizer code to make better decisions on what execution plans should and
should not be shared.
3) Having
many child cursors all associated with 1 parent cursor could perform. much worse
than having many parent cursors that would be seen with having the default
setting of cursor_sharing = EXACT (or FORCE). The scenario of many thousands of
child cursors associated with 1 parent results in a potential bottleneck for
searches for matching cursors (soft parsing) within the library cache.
The
cursor_sharing parameter was introduced as a workaround for legacy applications
that could not scale because they had not yet been redesigned to use bind
variables. It has been presumed that most applications have been redesigned
since then. If you are still using such an application, our recommendation is to
set cursor_sharing = FORCE. This setting maximizes cursor sharing while
leveraging the Adaptive Cursor Sharing framework to generate multiple execution
plans based on different literal value ranges if necessary.
Change the cursor_sharing to either FORCE or EXACT, keeping in mind the effects of either.
|
Products
| ||
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/195110/viewspace-739419/ ,如需转载,请注明出处,否则将追究法律责任。