Execution Plan error caused by an implicit conversion

Source: Internet
Author: User

Check the awr report and record the index failure caused by implicit conversion.

In awr, statements consume more than 40 million logical reads.

Variables are tested quickly.

SQL  a.order_prod_amount, b.prod_cost_price  user_sess a, PR_DO_T b  a.prod_id  b.prod_id  a.order_no  :: hash value:  Id   Operation                            Name         Rows   Bytes  Cost (CPU) Time      Pstart Pstop       STATEMENT                                                    () ::                     NESTED LOOPS                                                       () ::                       ACCESS  GLOBAL  ROWID user_sess                      () ::  ROWID  ROWID          SCAN                 SYS_C008504                      () ::                       ACCESS   ROWID        PR_DO_T                  () ::                        SCAN                 SYS_C008459                      () ::                    access("A"."ORDER_NO"  access("A"."PROD_ID"            bytes sent via SQLNet   bytes received via SQLNet   SQLNet roundtrips   sorts (  rows processed

View historical execution plans by statement sqlid

SQL  a.order_prod_amount, b.prod_cost_price  user_sess a, PR_DO_T b  a.prod_id  b.prod_id  a.order_no  88f4paj5t26xb

User_sess clearly misperformed the execution plan and used full table scan.

Suddenly, the user_sess table field order_no is varchar2, which is assumed to be implicit conversion.
Test with single quotes removed

SQL  a.order_prod_amount, b.prod_cost_price  user_sess a, PR_DO_T b  a.prod_id  b.prod_id  a.order_no  :: hash value:  Id   Operation                     Name         Rows   Bytes  Cost (CPU) Time      Pstart Pstop       STATEMENT                                        106K  () ::                     NESTED LOOPS                                           106K  () ::                      PARTITION RANGE                                    106K  () ::                    ACCESS           user_sess                106K  () ::                    ACCESS   ROWID PR_DO_T                         () ::                        SCAN          SYS_C008459                      () ::                    filter(TO_NUMBER("A"."ORDER_NO")  access("A"."PROD_ID"            bytes sent via SQLNet   bytes received via SQLNet   SQLNet roundtrips   sorts (  rows processed

Ask the developer to add the quotation marks to avoid implicit conversion and then restore



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.