Re: Plan Baseline
Date: Fri, 13 Aug 2021 09:29:30 +0100
Message-ID: <CAGtsp8nq2uZDrZf4V2mp+9MAY37WVSXXs0V0LQp5UKXkctHM2g_at_mail.gmail.com>
Mani,
Did you not notice the llines in the trace file saying
Then there's the line
SPM: couldn't reproduce any enabled+accepted plan so using the
cost-based plan, planId = 460841780
So clearly Oracle tried using your baseline, but didn't get the same plan
hash value as before.
Then you might recall an earlier post of mine saying: *In particular the one that leap to mind is the fact that you have several MERGE() hints in the outline - and there's an enhancement in 12.2.0.1 which deals with the problem that SPB's that contain MERGE() hints don't always reproduce the same plan because they don't specify what they merge into, only what they merge from. The unambiguous 12.2. syntax looks like: merge(_at_qb1 > qb2), e.g. merge(_at_SEL$12 > SEL$641071AC). So it's possible that with some change in estimated numbers the optimizer has merged query blocks in a different order - getting to the same final query block - and failed to reproduce the plan. *
Did you try searching MOS for details about that enhancement, or about a
bug where SPM plans didn't always reproduced with merge() hints. If you had
you might have found:
Bug 22542281 - MERGE hint syntax not explicit enough / syntax extended (Doc
ID 22542281.8)
and then followed the patch link to find that there are several patches
relating to 12.1.0.2 - so maybe you could patch your Oracle and get the SPB
working.
Finally - a little creative speculation - maybe when Oracle tries to apply the baseline the initial "ignore_optim_embedded_hints" makes it ignore the cardinality hint, so the plan that appears is affected by the sampled content of the collection. IF (note the IF) that's the case then could you bypass the problem by using the sql_patch to add the cardinality (opt_estimate) hint until you've had a chance to test the patch for the known defect.
On Fri, 13 Aug 2021 at 00:22, manikandan <pvmanikandan_at_gmail.com> wrote:
> Hi Jonathan,
>
>
> I totally agree to the point that the estimates for the collections are
> driving the plan change and spoke about this to the developers. As per
> them, they are using this cardinality hint in thousand's of queries. Back
> to this query, they are working on how to rewrite the code.
>
> We tried to create a sql patch with "OPT_PARAM("_optimizer_use_feedback"
> "FALSE") OPT_PARAM("_optimizer_ansi_join_lateral_enhance" "FALSE")" to the
> sql id , but that also seems not working. We did a 10053 trace (attached
> for your reference ) on this sql with baseline and sql patch in place , but
> could not find a good reason why its not picking baseline, may be I might
> have overlooked.
>
>
-- http://www.freelists.org/webpage/oracle-lReceived on Fri Aug 13 2021 - 10:29:30 CEST