Querying the execution of Oracle database SQL statements

Source: Internet
Author: User

1. View the top 10 SQL statements with the most total consumed time

SELECT * FROM (select v.sql_id, V.child_number, V.sql_text, V.elapsed_time, V.cpu_time, V.disk_reads, Rank () Over (o Rder by v.elapsed_time Desc) Elapsed_rank from V$sql v) a where Elapsed_rank <= 10;

2. View the top 10 SQL statements with the most CPU consumption time

SELECT * FROM (select v.sql_id, V.child_number, V.sql_text, V.elapsed_time, V.cpu_time, V.disk_reads, Rank () Over (o Rder by v.cpu_time Desc) Elapsed_rank from V$sql v) a where Elapsed_rank <= 10;

3. View the top 10 SQL statements that consume disk reads

SELECT * FROM (select v.sql_id, V.child_number, V.sql_text, V.elapsed_time, V.cpu_time, V.disk_reads, Rank () Over (o Rder by v.disk_reads Desc) Elapsed_rank from V$sql v) a where Elapsed_rank <= 10;

4. View the SQL that has the most executions of the current database, for example, query the SQL statement of top 15 that executes most frequently

Select Sql_text, executions from (select Sql_text, Executions, RANK () over (ORDER by executions DESC) Exec_rank from v$s Qlarea) WHERE Exec_rank <= 15;

Querying the execution of Oracle database SQL statements

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.