SQL Performance (MOSC)

MOSC Banner

qry with no binds is re-parsed on 2nd run and CBO chooses a much worse plan

edited Jun 13, 2014 12:00PM in SQL Performance (MOSC) 3 commentsAnswered

Hi,

This is actually an E-Business environment and the SQL code is being run through a bespoke Concurrent Request, but I don't se that being relevant, it's still SQL after all. Database is 11.2.0.1.

The problem is, when this SQL is run for the first time, it gets hard-parsed, and runs with a reasonable execution plan. If the same SQL is run again, pretty much straight away, so the SQL_ID is still cached in the library, it is getting hard parsed a second time, and for some reason the CBO is choosing a terrible plan full of FTS's. A third run of the qry will soft-parse and re-use the bad plan.  The CBO cost of the two plans is wildly different. The good one is 171285, and the bad one is 297919503.

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center