Home » SQL & PL/SQL » SQL & PL/SQL » How I will get top 10 or 20 SQL Statements
How I will get top 10 or 20 SQL Statements [message #8819] Mon, 29 September 2003 04:49 Go to next message
Pravin
Messages: 14
Registered: October 2001
Junior Member
Hi,

Please tell me, how I will get TOP 10 or 20 queries from a database.

Rgds

Pravin
Re: How I will get top 10 or 20 SQL Statements [message #8821 is a reply to message #8819] Mon, 29 September 2003 06:09 Go to previous messageGo to next message
rajesh
Messages: 173
Registered: November 1998
Senior Member
Hi
One way of doing is

select name,marks from ( select name,marks from stud order by marks desc ) where rownum <10
Re: How I will get top 10 or 20 SQL Statements [message #8822 is a reply to message #8819] Mon, 29 September 2003 06:17 Go to previous messageGo to next message
smithas@mascotsystems.com
Messages: 1
Registered: September 2003
Junior Member
select * from table_name where rownum < number_of_rows
Re: How I will get top 10 or 20 SQL Statements [message #8829 is a reply to message #8819] Mon, 29 September 2003 07:58 Go to previous message
Thiru
Messages: 1089
Registered: May 2002
Senior Member
Pravin,
By TOP , do you mean the most executed ? or most buffer gets ? or any other criteria.

For eg, have a look at my earlier post for Top most executed queries. You can change it to sort by buffer gets,physical reads etc ..

Hope this helps
Thiru

Previous Topic: How to check if a table exists
Next Topic: Multiple DML statements in a trigger
Goto Forum:
  


Current Time: Fri Apr 26 08:49:20 CDT 2024