How do I view the Explain Plan in Oracle Sql developer?

后端 未结 3 441
刺人心
刺人心 2020-12-13 12:32

I have few SQL queries which has very low query running performance and I want to check the query execution plan for this query. I am trying to execute the below query but i

相关标签:
3条回答
  • 2020-12-13 12:52

    We use Oracle PL/SQL Developer(Version 12.0.7). And we use F5 button to view the explain plan.

    0 讨论(0)
  • 2020-12-13 12:59

    EXPLAIN PLAN FOR

    In SQL Developer, you don't have to use EXPLAIN PLAN FOR statement. Press F10 or click the Explain Plan icon.

    enter image description here

    It will be then displayed in the Explain Plan window.

    If you are using SQL*Plus then use DBMS_XPLAN.

    For example,

    SQL> EXPLAIN PLAN FOR
      2  SELECT * FROM DUAL;
    
    Explained.
    
    SQL> SELECT * FROM TABLE(DBMS_XPLAN.DISPLAY);
    
    PLAN_TABLE_OUTPUT
    --------------------------------------------------------------------------
    Plan hash value: 272002086
    
    --------------------------------------------------------------------------
    | Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    --------------------------------------------------------------------------
    |   0 | SELECT STATEMENT  |      |     1 |     2 |     2   (0)| 00:00:01 |
    |   1 |  TABLE ACCESS FULL| DUAL |     1 |     2 |     2   (0)| 00:00:01 |
    --------------------------------------------------------------------------
    
    8 rows selected.
    
    SQL>
    

    See How to create and display Explain Plan

    0 讨论(0)
  • 2020-12-13 13:10

    Explain only shows how the optimizer thinks the query will execute.

    To show the real plan, you will need to run the sql once. Then use the same session run the following:

    @yoursql 
    select * from table(dbms_xplan.display_cursor()) 
    

    This way can show the real plan used during execution. There are several other ways in showing plan using dbms_xplan. You can Google with term "dbms_xplan".

    0 讨论(0)
提交回复
热议问题