RE: Optimizer estimated cardinality very low

From: Noveljic Nenad <nenad.noveljic_at_vontobel.com>
Date: Tue, 27 Oct 2020 13:03:52 +0000
Message-ID: <15909_1603803849_5F981AC9_15909_4502_1_9d6be7519f8e4c75a2902e1f2ba44bf1_at_vontobel.com>



Hi Daniel,

“NUM_DISTINCT for the column_group in July are lower than ORDR_RQST_NUMBER instead of being equal or higher.”

This is exactly the reason that sanity check kicks in.

“ This happens across other partitions but the estimation doesn't seem impacted by this alone.”

There is some tolerance range. Set num_distinct for SYS_STU4S$4GK1UDMC2M8$MI#W6QS_ of the June partition to a sufficiently low value for sanity check to kick in. Then you should get sel = 1.0 and a “good” cardinality estimate for your case.

“but the estimation doesn't seem impacted by this alone.”

Histogram on ORDR_RQST_DATE is apparently another prerequisite for the sanity check.

Best regards,

Nenad

https://nenadnoveljic.com/blog

From: Daniel Coello <coello.daniel_at_gmail.com> Sent: Montag, 26. Oktober 2020 18:07
To: Noveljic Nenad <nenad.noveljic_at_vontobel.com> Cc: ORACLE-L (oracle-l_at_freelists.org) <oracle-l_at_freelists.org> Subject: Re: Optimizer estimated cardinality very low

Hi Nenand.

For when the interval when the estimation is good: ...
Join ColGroups for ORDER_REQST[ORDER_REQST] and ORDER_DETL[ORDER_DETL] : Using cdn sanity check ...

Below is some information relevant to the columns: ORDER_REQST PARTITION_NAME COLUMN_NAME NUM_DISTINCT NUM_BUCKETS SAMPLE_SIZE HISTOGRAM NUM_ROW IN PARTITION JULY SYS_P971481 ORDR_RQST_DATE 3

3

26895392

FREQUENCY 26895392

SYS_P971481 SYS_STU4S$4GK1UDMC2M8$MI#W6QS_ 26636288

1

26895392

NONE 26895392

SYS_P971481 ORDR_RQST_NUMBER 26895392

1

26895392

NONE 26895392

JUNE SYS_P964661 ORDR_RQST_DATE 4

4

17506471

FREQUENCY 17506471

SYS_P964661 SYS_STU4S$4GK1UDMC2M8$MI#W6QS_ 15794176

1

17506471

NONE 17506471

SYS_P964661 ORDR_RQST_NUMBER 15649792

1

17506471

NONE 17506471

ORDER_DETL PARTITION_NAME COLUMN_NAME NUM_DISTINCT NUM_BUCKETS SAMPLE_SIZE HISTOGRAM NUM_ROW IN PARTITION JULY SYS_P971761 ORDR_RQST_DATE 3

3

32314200

FREQUENCY 32314200

SYS_P971761 SYS_STU4S$4GK1UDMC2M8$MI#W6QS_ 26636288

1

32314200

NONE 32314200

SYS_P971761 ORDR_RQST_NUMBER 26984448

1

32314200

NONE 32314200

JUNE SYS_P964866 ORDR_RQST_DATE 4

4

21814573

FREQUENCY 21814573

SYS_P964866 SYS_STU4S$4GK1UDMC2M8$MI#W6QS_ 15794176

1

21814573

NONE 21814573

SYS_P964866 ORDR_RQST_NUMBER 15649792

1

21814573

NONE 21814573

Things that have been pointed out to me or relevant to the env:

- NUM_DISTINCT for the column_group in July are lower than ORDR_RQST_NUMBER instead of being equal or higher. This happens across other partitions but the estimation doesn't seem impacted by this alone.
- I added the NUM_ROW values from the partitions for comparison with the total number of rows in it.
- ORDER_DETL columns' values should exist in ORDER_REQST, there shouldn't be an orphan row which in real counts you can see.


  • The actual count for distincts are: July: ORDER_REQST ORDR_RQST_NUMBER: 26846523 COL_GROUP ( ORDR_RQST_NUMBER , ORDR_RQST_DATE ): 26846523
ORDER_DETL
ORDR_RQST_NUMBER: 26846523
COL_GROUP ( ORDR_RQST_NUMBER , ORDR_RQST_DATE ) : 26846523 June:
ORDER_REQST
ORDR_RQST_NUMBER : 15683040
COL_GROUP ( ORDR_RQST_NUMBER , ORDR_RQST_DATE ) : 15683040 ORDER_DETL
ORDR_RQST_NUMBER : 15683040
COL_GROUP ( ORDR_RQST_NUMBER , ORDR_RQST_DATE ) : 15683040 Thanks,

Please consider the environment before printing this e-mail. Bitte denken Sie an die Umwelt, bevor Sie dieses E-Mail drucken.

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">p { font-family: Arial;font-size:9pt }</style>
</head>
<body>
<p>
<br>Important Notice</br>
<br />

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.<br /> 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.<br /> 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.</br> 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.<br /> 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 <a href="https://www.vontobel.com">www.vontobel.com</a>.<br />
</p>
</body>
</html>

--
http://www.freelists.org/webpage/oracle-l
Received on Tue Oct 27 2020 - 14:03:52 CET

Original text of this message