11gR2 : Using pending statistics
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;
1