Thursday, April 07, 2011

What's old is new again

We had a fair number of problems related to bind variable peeking in our and dbs.  In fact, the plans became so erratic that we decided to just turn bind variable peeking off by setting _optim_peek_user_binds=false in all the init.ora files.

Flash forward to Oracle 11g ( and the optimizer has been enhanced to use bind variable peeking much better.  After converting to 11g, one of my queries was running slower than before.  I ran the slow query with hard-coded values and it finished in less than a second.  I then tried the same thing with bind variables and it ran in 2400 seconds, with a different execution plan.

These were the exact symptoms that originally brought me to set _optim_peek_user_binds in the first place.  My first thought was that I left the underscore parameters commented out after the upgrade.  Nope, it was set "correctly", or at least how I thought it should be set.

I then set optimizer_features_enable back to for my session and re-executed the query.  Sure enough, it was back to sub-second response time.  I switched the optimizer_features_enable back to and it was slow again.  Aha, something changed!

More research yeilded some documentation to digest:

After much reading, thought, and testing, I decided that _optim_peek_user_binds=false was not needed in 11g for my environment.


Anonymous said...

What was the solution to obtain the same performance as 10.2?


Jeff Hunter said...

I took _optim_peek_user_binds=false out of the init.ora