Re: Optimizer estimated cardinality very low

From: Daniel Coello <coello.daniel_at_gmail.com>
Date: Fri, 16 Oct 2020 18:20:42 -0400
Message-ID: <CADX5pQUgXT6K+731sNi7VpGnw5Kktb4POvTegJvRoLD1agJr_w_at_mail.gmail.com>



Hello,

I have replied privately to Jonathan regarding the 10053 traces.

Nenad,

Thanks for sharing your case. The scenario itself with the estimation is very similar and as you have stated "a one-row estimation is often a cue for a completely wrong calculation." when in my case should have been in the order of millions. My thought is there is an issue on the join calculation (stats, optimizer code, combination of both, etc.)

For my environment, the version is 12.1 , directives are not in use and issue comes up with or without DS. I tried the workaround just in case it would be helpful and results were the same 1 row estimation.

Thanks again!

On Wed, Oct 14, 2020 at 9:17 AM Noveljic Nenad <nenad.noveljic_at_vontobel.com> wrote:

> A background information for my ask:
>
>
>
> I hit a similar problem once where the join cardinality=1 was a
> consequence of a wrong adjustment after dynamic sampling. The wrong
> adjustment bug was introduced with the bug fix 22817465 : AUTODOP
> CALCULATES DOP OF 1 FOR SPECIFIC QUERY. Therefore, the cardinality was
> correct after switching off this bug fix.
>
>
>
> The following unpublished bug was raised for this problem Bug 27989222 :
> WRONG CARDINALITY ESTIMATION WITH STALE DIRECTIVES WHEN FIX 21802552 IS
> ENABLED.
>
>
>
> I elaborated on this issue here:
> https://nenadnoveljic.com/blog/join-cardinality-misestimate/
>
>
>
> You might be hitting the same bug, as your plan is generated by using plan
> directives and dynamic sampling.
>
>
>
> Best regards,
>
>
>
> Nenad
>
>
>
>
>
> *From:* Noveljic Nenad
> *Sent:* Mittwoch, 14. Oktober 2020 10:49
> *To:* 'jlewisoracle_at_gmail.com' <jlewisoracle_at_gmail.com>; Daniel Coello <
> coello.daniel_at_gmail.com>
> *Cc:* Oracle L <Oracle-L_at_freelists.org>
> *Subject:* RE: Optimizer estimated cardinality very low
>
>
>
> Could you try with
>
>
>
> alter session set "_fix_control"='21802552:off';
>
> Best regards,
>
>
>
> Nenad
>
>
>
> https://nenadnoveljic.com/blog
>
>
>
>
>
>
>
> *From:* oracle-l-bounce_at_freelists.org <oracle-l-bounce_at_freelists.org> *On
> Behalf Of *Jonathan Lewis
> *Sent:* Mittwoch, 14. Oktober 2020 10:44
> *To:* Daniel Coello <coello.daniel_at_gmail.com>
> *Cc:* Oracle L <Oracle-L_at_freelists.org>
> *Subject:* Re: Optimizer estimated cardinality very low
>
>
>
>
>
> Daniel,
>
>
>
> I've lost count of the number of times I've said: "you hardly ever need to
> read the 10053 (CBO) trace file"; but in this case I think I need to see
> the 10053 trace file.
>
> I suspect the issue is something to do with the hybrid histogram and the
> fact that the July data is the top partition of the table but I can't think
> of anything that would make the cardinality estimate drop to 1.
>
>
>
> If you could enable event 10053 ('alter session set events '10053 trace
> name context forever'; and execute the june and july statements and send me
> the trace files (zip'ed would be good). Please start a fresh session for
> each query so that they are in different files, and to make sure that the
> optimizer does actually optimize them afresh (which is when the 10053 trace
> is generated) add small comment to each statement.
>
>
>
> Regards
>
> Jonathan Lewis
>
>
>
> ____________________________________________________
>
> Please consider the environment before printing this e-mail.
>
> Bitte denken Sie an die Umwelt, bevor Sie dieses E-Mail drucken.
>
>
> Important Notice
> This message is intended only for the individual named. It may contain
> confidential or privileged information. If you are not the named addressee
> you should in particular not disseminate, distribute, modify or copy this
> e-mail. Please notify the sender immediately by e-mail, if you have
> received this message by mistake and delete it from your system.
> Without prejudice to any contractual agreements between you and us which
> shall prevail in any case, we take it as your authorization to correspond
> with you by e-mail if you send us messages by e-mail. However, we reserve
> the right not to execute orders and instructions transmitted by e-mail at
> any time and without further explanation.
> E-mail transmission may not be secure or error-free as information could
> be intercepted, corrupted, lost, destroyed, arrive late or incomplete. Also
> processing of incoming e-mails cannot be guaranteed. All liability of
> Vontobel Holding Ltd. and any of its affiliates (hereinafter collectively
> referred to as "Vontobel Group") for any damages resulting from e-mail use
> is excluded. You are advised that urgent and time sensitive messages should
> not be sent by e-mail and if verification is required please request a
> printed version. Please note that all e-mail communications to and from the
> Vontobel Group are subject to electronic storage and review by Vontobel
> Group. Unless stated to the contrary and without prejudice to any
> contractual agreements between you and Vontobel Group which shall prevail
> in any case, e-mail-communication is for informational purposes only and is
> not intended as an offer or solicitation for the purchase or sale of any
> financial instrument or as an official confirmation of any transaction.
> The legal basis for the processing of your personal data is the legitimate
> interest to develop a commercial relationship with you, as well as your
> consent to forward you commercial communications. You can exercise, at any
> time and under the terms established under current regulation, your rights.
> If you prefer not to receive any further communications, please contact
> your client relationship manager if you are a client of Vontobel Group or
> notify the sender. Please note for an exact reference to the affected group
> entity the corporate e-mail signature. For further information about data
> privacy at Vontobel Group please consult www.vontobel.com.
>

-- 
Daniel Coello Villacis

--
http://www.freelists.org/webpage/oracle-l
Received on Sat Oct 17 2020 - 00:20:42 CEST

Original text of this message