Oracle Tools Class SQL

Source: Internet
Author: User

First, the query performs the slowest SQL

SELECT * FROM (select SA. Sql_text,        SA. Sql_fulltext,        SA. Executions "number of executions",        round (SA. elapsed_time/1000000, 2) "Total execution time",        round (SA. Elapsed_time/1000000/sa. Executions, 2) "Average execution time",        Sa.command_type,        SA. parsing_user_id "User ID",        u.username "user name",        SA. Hash_value from     V$sqlarea sa left     join all_users u on      sa. parsing_user_id = u.user_id     where SA. Executions > 0     ORDER by (SA. Elapsed_time/sa. executions) desc) where rownum <= 50;

Second, the most frequently queried SQL

SELECT * FROM (select S.sql_text,        s.executions "number of executions",        s.parsing_user_id "username",        rank () over (order by Executions desc) Exec_rank from     V$sql s left     joins All_users u on      u.user_id = s.parsing_user_id) T where Exec_r Ank <= 100;

Summarize

Oracle Tools Class SQL

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.