Monitor Oracle execution plans

Source: Internet
Author: User
In daily development activities, Oracle execution plans are sometimes monitored to optimize program and database performance. There are several common methods: 1.

In daily development activities, Oracle execution plans are sometimes monitored to optimize program and database performance. There are several common methods: 1.

In daily development activities, Oracle execution plans are sometimes monitored to optimize program and database performance.

There are several common methods:

1. Use the PL/SQL Dev Tool
1. directly File-> New-> Explain Plan Window. Execute SQL statements in the Window to view the Plan results. Among them, Cost indicates the cpu consumption, unit is n %, Cardinality indicates the number of lines executed, equivalent to Rows.
2. Execute the explain plan for select * from tableA where paraA = 1, and then select * from table (DBMS_XPLAN.DISPLAY) to view the oracle execution PLAN, the result is the same as that in 1. Therefore, we recommend that you use the 1 method when using the tool.
Note: The Command window of PL/SQL Dev does not support the set autotrance on Command. You can also use the tool to view the incomplete information of the plan. Sometimes we need sqlplus support.

Ii. Use sqlplus
1. Generally, the local machine is connected to a remote server, so the command is as follows:
Sqlplus user/pwd @ serviceName
The serviceName here is the namespace defined in tnsnames. ora.
2. Execute set autotrace on and then execute the SQL statement to list the following information:
... (Omitted information)
Statistics
1 recursive cballs (number of calls)
0 db block gets
2 consistent gets
0 physical reads (physical read-the number of data blocks read from the hard disk during SQL Execution)
0 redo size (number of retries-the size of the redo log generated during SQL Execution)
358 bytes sent via SQL * Net to client
366 bytes encoded ed via SQL * Net from client
1 SQL * Net roundtrips to/from client
0 sorts (memory) sorting in memory
0 sorts (disk) sorting in Hard disk
1 rows processed
The omitted information is the same as the information used to view the execution plan through the PL/SQL Dev tool. The following statistical information is more detailed.
Determining the SQL efficiency is not measured by time, but also by the number of logical reads in the SQL Execution status.
Logical READ = (db block gets + consistent gets)

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.