The Top x query can be applied to administrative queries. This common analytic query will come in handy if you are looking for top resource consumers
For example to see the top 10 largest tables in the database, the following query can be used:
Select owner, segment_name, segment_type, bytes
from (
Select owner, segment_name, segment_type, bytes,
rank () over
(order by bytes desc) as rank
from dba_segments)
where rank <= 10
This query can also be used against system tables such as v$sqlstats and v$segment_statistics to obtain performance information about the database. Using rank you can easily select the data you want.
No comments:
Post a Comment