Reducing Hard parses [message #529744] |
Wed, 02 November 2011 13:58 |
|
Rags123
Messages: 39 Registered: July 2011 Location: United Kingdom
|
Member |
|
|
Hi,
The hard parse that happens in our database is typically around 140 per second and it goes up to 200 per second during peak load period. THe cursor_sharing is set to SIMILAR.
Is there a way to identify the SQLs which contribute to the hard parsing? I do have an sql blacklist but I need some way to check if they contribute to hard parsing.
I did google a lot but could not quite find many useful pointers.
Is it correct if I say that multiple entries of the same sql_id in v$sql indicates that the particular sql is being hard parsed everytime?
Any help would be appreciated.
|
|
|
|
|
|
|
|
|
Re: Reducing Hard parses [message #529874 is a reply to message #529871] |
Thu, 03 November 2011 08:40 |
John Watson
Messages: 8960 Registered: January 2010 Location: Global Village
|
Senior Member |
|
|
I can only repeat myself: why do you think parsing is a problem? The evidence (if there is any) will be in your AWR reports: in the Time Model statistics you have the proportion of DB Time spent on hard parsing.
|
|
|
|
|
Re: Reducing Hard parses [message #529905 is a reply to message #529879] |
Thu, 03 November 2011 09:51 |
|
Rags123
Messages: 39 Registered: July 2011 Location: United Kingdom
|
Member |
|
|
Hi John,
I dont know if hard parsing is the problem. And I want to validate if that is the problem before we think of solving it.
From the AWR report, I am aware that there is heavy hard parse that happens in our db (around 150 per second)
As per time model statistics %db of hard parse is 5.67.
Lnossov,
I executed the query and just posting the first 2 rows.
ayyfcu5tq5zkg 201
8u1c0csm9ungb 189
[Updated on: Thu, 03 November 2011 09:53] Report message to a moderator
|
|
|
Re: Reducing Hard parses [message #529906 is a reply to message #529905] |
Thu, 03 November 2011 09:57 |
John Watson
Messages: 8960 Registered: January 2010 Location: Global Village
|
Senior Member |
|
|
Do you think 5.67% is worth attempting to tune? Is it really the worst problem? Probably not. Forget about it until you have fixed more important issues.
|
|
|
|
|
Re: Reducing Hard parses [message #529946 is a reply to message #529928] |
Thu, 03 November 2011 11:52 |
|
Rags123
Messages: 39 Registered: July 2011 Location: United Kingdom
|
Member |
|
|
Hi LNossov,
Yes of course I would want to improve things if possible.
I checked the V$sql_Shared_Cursor for the top 10 SQLs. For majority them the reason is INCOMPLETE_CURSOR. I googled about it and got to know it means "Cursor is incomplete: typecheck heap came from call memory" but couldnt quite catch that!
[Updated on: Thu, 03 November 2011 12:01] Report message to a moderator
|
|
|
Re: Reducing Hard parses [message #529952 is a reply to message #529946] |
Thu, 03 November 2011 12:14 |
|
LNossov
Messages: 318 Registered: July 2011 Location: Germany
|
Senior Member |
|
|
If all fields of v$sql_shared_cursor are 'N' in 10g, it is a sign, that cursor_sharing=similar is a reason for opening the new cursors. As we already assumed . You can get different execution plans, because of different values of bind variables (literals).
[Updated on: Thu, 03 November 2011 12:15] Report message to a moderator
|
|
|
|
|
|
|
|
Re: Reducing Hard parses [message #529968 is a reply to message #529963] |
Thu, 03 November 2011 13:19 |
|
Michel Cadot
Messages: 68716 Registered: March 2007 Location: Saint-Maur, France, https...
|
Senior Member Account Moderator |
|
|
Quote:You can think once more about parameter setting cursor_sharing=force.
Just search search for "cursor_sharing force" on Metalink bug database and you will more
than one hundred bugs with database crash, wrong result and so forth.
Never use it. It is better to have bad performances than to have wrong results.
This remember me one of my math teacher which once told us: "I calculate fast but I calculate wrong".
Regards
Michel
[Updated on: Thu, 03 November 2011 13:21] Report message to a moderator
|
|
|
|
|
|
|
|
|
Re: Reducing Hard parses [message #529979 is a reply to message #529976] |
Thu, 03 November 2011 16:18 |
|
LNossov
Messages: 318 Registered: July 2011 Location: Germany
|
Senior Member |
|
|
It sounds better. You don't want to cancel completely the Oracle feature cursor_sharing anymore.
Let us return to our concrete problem. Rgs123 is using cursor_sharing=similar. From your experiences you should know, that the most of issues with cursor_sharing (practically all of wrong results issues) occur if cursor_sharing <> exact regardless of similar or force value. So, if I suggest to use force instead of similar, I can only improve the situation.
Any objection?
Regards
Leonid
[Updated on: Thu, 03 November 2011 16:42] Report message to a moderator
|
|
|
Re: Reducing Hard parses [message #530033 is a reply to message #529979] |
Fri, 04 November 2011 04:36 |
cookiemonster
Messages: 13958 Registered: September 2008 Location: Rainy Manchester
|
Senior Member |
|
|
Just to throw a spanner in the works: Oracle think force is better than similar and are discontinuing similar from oracle 12 and advise you stop using it in 11.
Have a look at metalink note 1169017.1
The OP is on 10 so might not matter to them.
|
|
|
|