What we can analyze ?
We can analyze TABLE ,INDEX , Materialized Views, Clusters
How to Analyze ?
For detailed syntax use oracle sites.
For versions prior to 8i we can use analyze command as below
analyze table 'tablename' compute / estimate statistics
Examples will give more detailed understanding.
analyze table employees compute statistics
analyze table employees estimate statistics sample ( 10 percent / 100 rows)
analyze table employees delete statistics
To analyze index use below codes
analyze index indexname compute/delete/estimate statistics
The above all examples are for backward compatibility so if you have database installed > 8i please do not use above.
Insted use DBMS_STATS package.
HOwever if you need to collect statistics unrelated to optimizer then we must use analyze statement.
for versions above 8i use the below.
exec dbms_stats.gather_table_status ('schema','tablename',cascade => true);
What happends in the background when above query is used ?
Oracle calculates number of rows, empty blocks,number of blocks below high water mark etc.
This is frequently used by DBA when query is taking more time than anticipated.
We can analyze TABLE ,INDEX , Materialized Views, Clusters
How to Analyze ?
For detailed syntax use oracle sites.
For versions prior to 8i we can use analyze command as below
analyze table 'tablename' compute / estimate statistics
Examples will give more detailed understanding.
analyze table employees compute statistics
analyze table employees estimate statistics sample ( 10 percent / 100 rows)
analyze table employees delete statistics
To analyze index use below codes
analyze index indexname compute/delete/estimate statistics
The above all examples are for backward compatibility so if you have database installed > 8i please do not use above.
Insted use DBMS_STATS package.
HOwever if you need to collect statistics unrelated to optimizer then we must use analyze statement.
for versions above 8i use the below.
exec dbms_stats.gather_table_status ('schema','tablename',cascade => true);
What happends in the background when above query is used ?
Oracle calculates number of rows, empty blocks,number of blocks below high water mark etc.
This is frequently used by DBA when query is taking more time than anticipated.
No comments :
Post a Comment