View SQL Execution plans and statistics in Oracle

Source: Internet
Author: User
-- Obtain the SQL Execution Plan and statistics without displaying the Query Information SQLgt; setautotracetraceonly; SQLgt; select * fromtest; Execution Plan -----

-- Obtain the SQL Execution Plan and statistical information, without displaying the Query Information SQLgt; set autotrace traceonly; SQLgt; select * from test; Execution Plan -----

Homepage → Database Technology

Background:

Read News

View SQL Execution plans and statistics in Oracle

[Date:] Source: Linux community Author: AnyJack [Font:]

-- Obtain the SQL Execution Plan and statistics without displaying Query Information
SQL> set autotrace traceonly;
SQL> select * from test;
Execution Plan
----------------------------------------------------------
Plan hash value: 1357081020
--------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (% CPU) | Time |
--------------------------------------------------------------------------
| 0 | select statement | 2 | 130 | 3 (0) | 00:00:01 |
| 1 | table access full | TEST | 2 | 130 | 3 (0) | 00:00:01 |
--------------------------------------------------------------------------
Note
-----
-Dynamic sampling used for this statement
Statistics
----------------------------------------------------------
0 recursive cballs
0 db block gets
8 consistent gets
6 physical reads
0 redo size
523 bytes sent via SQL * Net to client
416 bytes encoded ed via SQL * Net from client
2 SQL * Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
2 rows processed
========================================================== ======================================
-- Only display statistics
SQL> set autot traceonly stat;
SQL> select * from test;
Statistics
----------------------------------------------------------
0 recursive cballs
0 db block gets
8 consistent gets
0 physical reads
0 redo size
523 bytes sent via SQL * Net to client
416 bytes encoded ed via SQL * Net from client
2 SQL * Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
2 rows processed
========================================================== ======================================
-- Display only the execution plan
SQL> set autot traceonly exp;
SQL> select * from test;
Execution Plan
----------------------------------------------------------
Plan hash value: 1357081020
--------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (% CPU) | Time |
--------------------------------------------------------------------------
| 0 | select statement | 2 | 130 | 3 (0) | 00:00:01 |
| 1 | table access full | TEST | 2 | 130 | 3 (0) | 00:00:01 |
--------------------------------------------------------------------------
Note
-----
-Dynamic sampling used for this statement
========================================================== ======================================
-- Enable SQL tracking to display query results, execution plans, and statistics
SQL> set autot on;
SQL> select * from test;
T_ID T_NAME
Bytes -------------------------------------------------------------------------------------
1 t1
2 t2
Execution Plan
----------------------------------------------------------
Plan hash value: 1357081020
--------------------------------------------------------------------------
| Id | Operation | Name | Rows | Bytes | Cost (% CPU) | Time |
--------------------------------------------------------------------------
| 0 | select statement | 2 | 130 | 3 (0) | 00:00:01 |
| 1 | table access full | TEST | 2 | 130 | 3 (0) | 00:00:01 |
--------------------------------------------------------------------------
Note
-----
-Dynamic sampling used for this statement
Statistics
----------------------------------------------------------
0 recursive cballs
0 db block gets
8 consistent gets
0 physical reads
0 redo size
523 bytes sent via SQL * Net to client
416 bytes encoded ed via SQL * Net from client
2 SQL * Net roundtrips to/from client
0 sorts (memory)
0 sorts (disk)
2 rows processed
========================================================== ======================================
-- Disable SQL tracing and only display query results
SQL> set autot off;
SQL> select * from test;
T_ID T_NAME
-------------------------------------------------------
1 t1
2 t2

  • 0
  • Use SAS macro to implement the decode function in Oracle

    Oracle RMAN loss archive log: ORA-19625: error identifying file

    Oracle tutorial

    Image Information

    View All comments in this article (0)

    Comments

    Latest Information

    Popular this week

    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.