View execution plan method summary: The explain plan command

Source: Internet
Author: User

There are many ways to view execution plans. I will introduce them one by one in my blog in the future. This article describes the first method. You can use the explain plan command to view the execution plan.
 
1. log on to the database with an hr user
[Oracle @ ENMOEDU ~] $ Sqlplus hr/oracle @ ENMOEDU
 
SQL * Plus: Release 11.2.0.3.0 Production on Thu Apr 10 00:11:00 2014
Copyright (c) 1982,201 1, Oracle. All rights reserved.
Connected:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0-Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
 
HR @ ENMOEDU>
 
2. Use the explain plan command
HR @ ENMOEDU> explain plan for select salary from employees where first_name like 'pat ';
 
Explained.
 
3. view the execution plan
HR @ ENMOEDU> select * from table (dbms_xplan.display );
 
PLAN_TABLE_OUTPUT
------------------------------------------------------------------------
Plan hash value: 3033625502
Bytes -------------------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (% CPU) | Time |
Bytes -------------------------------------------------------------------------------------------
| 0 | select statement | 1 | 11 | 2 (0) | 00:00:01 |
| 1 | table access by index rowid | EMPLOYEES | 1 | 11 | 2 (0) | 00:00:01 |
| * 2 | index skip scan | EMP_NAME_IX | 1 | 1 (0) | 00:00:01 |
Bytes -------------------------------------------------------------------------------------------
Predicate Information (identified by operation id ):
---------------------------------------------------
2-access ("FIRST_NAME" = 'pat ')
Filter ("FIRST_NAME" = 'pat ')
 
15 rows selected.
 
Now, the execution plan is successfully viewed.

Related Article

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.