SQL Performance (MOSC)

MOSC Banner

11gR2 : Using pending statistics

edited May 23, 2013 5:23AM in SQL Performance (MOSC) 4 commentsAnswered
 Hi ,I  have to execute queries by using pending statistics in 11gR2.

Statistics should be gathered  for all tables of my schema and all partitions of each table.

What do  you think about steps , procedures and parameters used ?
Thanks
GD.

1/ Set pending statistics :

DBMS_STATS.SET_SCHEMA_PREFS('MY_SCHEMA','PUBLISH','FALSE');

2/ Gather pending statistics :   

DBMS_STATS.GATHER_SCHEMA_STATS ( 
   ownname          =>  'MY_SCHEMA', 
   estimate_percent =>  'DBMS_STATS.AUTO_SAMPLE_SIZE',
   method_opt       =>  'FOR ALL COLUMNS SIZE AUTO',
   degree           =>  'auto_degree', 
   granularity      =>  'GLOBAL AND PARTITION', 
   cascade          =>  'TRUE'
   );
   
3/ Use pending statistics within my session :
alter session set optimizer_use_pending_statistics = true;

Howdy, Stranger!

Log In

To view full details, sign in to My Oracle Support Community.

Register

Don't have a My Oracle Support Community account? Click here to get started.

Category Leaderboard

Top contributors this month

New to My Oracle Support Community? Visit our Welcome Center

MOSC Help Center